Change levels of factor columns
For factor columns, the levels can be changed directly (and by reference). This is particularly usefull for fast preprocessing (e.g., making tokens lowercase, )
column |
the name of the column |
levels |
The new levels |
Usage:
## R6 method for class tCorpus. Use as tc$method (where tc is a tCorpus object).
set_levels(column, levels)
set_meta_levels(column, levels)
tc = create_tcorpus(c('Text one first sentence. Text one second sentence', 'Text two')) ## change factor levels of a column in the token data unique_tokens <- tc$get_levels('token') tc$set_levels('token', toupper(unique_tokens)) tc$tokens
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.