The latest version of tm
(0.60) made it so you can’t use functions with tm_map
that operate on simple character values any more. So the problem is your tolower
step since that isn’t a “canonical” transformation (See getTransformations()
). Just replace it with
corpus <- tm_map(corpus, content_transformer(tolower))
The content_transformer
function wrapper will convert everything to the correct data type within the corpus. You can use content_transformer
with any function that is intended to manipulate character vectors so that it will work in a tm_map
pipeline.