I'm using the quanteda package to construct DFMs in order to train a model on a dfm so that I can predict values for a new unknown dataset. Using predict() this works fine as long as the both sets have the same number of features, if not I get this error:
Cholmod error 'A and B inner dimensions must match'
To ensure that the number of features is identical one can use selectFeatures or the argument keptFeatures in the dfm-function.
My problem is that I simply cannot find these functions. I have:
re-installed the quanteda package.
restarted R.
made sure I have the newest package version 1.2.0
checked the github page for quanteda to check if the functions have been removed.
All to no avail. All I get are these error messages:
textVec1 <- c("This is text one.", "This, the second text.", "Here: the third text.")
textVec2 <- c("Here are new words.", "New words in this text.")
dfm1 <- dfm(textVec1)
dfm2a <- dfm(textVec2)
dfm2b <- dfm(textVec2, keptFeatures = dfm1)
Warning messages:
1: Argument keptFeatures not used.
2: Argument keptFeatures not used.
dfm <- selectFeatures(dfm1, features = dfm2)
Error in selectFeatures(dfmshort, features = dfmacts) : could not find function "selectFeatures"
Do I need an additional package to run these functions?