Nathalie
Nathalie

Reputation: 1238

Wrong statement for tokens remove

I have created a token and I want to remove specific feature.

I use this:

toks <- tokens_remove(toks,
           remove_punct = TRUE, 
           remove_numbers = TRUE, 
           remove_symbols = TRUE)

However this is the error:

Error in tokens_select(x, ..., selection = "remove") : 
  unused arguments (remove_punct = TRUE, remove_numbers = TRUE, remove_symbols = TRUE)

How is the right syntax?

Upvotes: 0

Views: 125

Answers (1)

phiver
phiver

Reputation: 23608

Using remove_xxx should be used when creating a tokens object with tokens not when using tokens_remove.

If you want to use tokens_remove with removing other items you could do something like this:

toks <- tokens_remove(tokens(txt, # a character, corpus, or tokens object 
                             remove_punct = TRUE, 
                             remove_numbers = TRUE, 
                             remove_symbols = TRUE
                             )
                      )

Upvotes: 1

Related Questions