I have a dataframe IRC_DF and I would like to create an iterator over input objects to vocabularies, for this I try to do like this :
it_train <- itoken(IRC_DF$Raison.Reco, preprocessor = prep_fun,
tokenizer = tok_fun, ids = IRC_DF$ID, progressbar = FALSE)
But I get this error :
Error in UseMethod("itoken") :
no applicable method for 'itoken' applied to an object of class "factor"
Any idea please?
Use the function as.character() on IRC_DF$Raison.Reco before using it on itoken.
IRC_DF$Raison.Reco <- as.character(IRC_DF$Raison.Reco)
it_train = itoken(IRC_DF$Raison.Reco, preprocessor = prep_fun, tokenizer = tok_fun, ids = IRC_DF$ID, progressbar = FALSE)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With