tm loses the metadata when applying tm_map

只愿长相守 提交于 2019-12-03 20:14:49
momobo

I found it.

The line:

myCorpus <- tm_map(myCorpus, PlainTextDocument)

solves the problem but erase the metadata.

I found this answer that explain a better way to use tm_map(). I just have to substitute:

myCorpus <- tm_map(myCorpus, tolower)

with:

myCorpus <- tm_map(myCorpus, content_transformer(tolower))

And all works!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!