【发布时间】:2018-12-24 17:54:17
【问题描述】:
所以我对 R 比较陌生,我正在学习如何从这个方便的网站挖掘文本:https://eight2late.wordpress.com/2015/05/27/a-gentle-introduction-to-text-mining-using-r/
我确实有自己的 .doc、.docx 和 .xlsx 文件文本集,我正在尝试挖掘它们。它们位于我的工作目录中名为“files”的文件夹中,但我在简单地编写了几行代码后就遇到了错误。
我目前的代码是:
library(tm)
library(readtext)
data = readtext('files')
此时,等待25秒左右后,我得到了错误:
Error: System call to 'antiword' failed (1): The Big Block Depot is damaged
代码在那里停止运行。
我曾尝试在线搜索解决方案,但这似乎是一个相当罕见的错误,因此我在 https://github.com/ropensci/antiword/issues/1 上只找到了 1 个可能的解决方案,但这对我不起作用。
此解决方案表明我的一个文件已损坏,并建议使用代码
fixInNamespace(antiword, pos="package:antiword")
将错误更改为不中断文件读取的警告。我试过了,一开始它引发了错误
Error in as.environment(pos):
no item called "package:antiword" on the search list
之后,我用library(antiword) 加载了反字库并将stop( 更改为warning(。但是,当我再次运行data = readtext('files') 行时,它立即引发了错误
Error in is_windows() : could not find function "is_windows"
我在这里不知所措!任何帮助,将不胜感激。在这种情况下我应该使用另一个包吗?
【问题讨论】:
-
看来,缺少的功能可以在你链接的 github 网站上的 goodmansasha 的帖子中找到。
is_windows <- function() identical(.Platform$OS.type, "windows")。这有帮助吗? -
哦,是的,谢谢!这很有帮助,但是现在当我运行代码时,我得到了一个
Error: Failed to execute 'C:\.......library\3.5\antiword\bin\antiword' (The system cannot find the file specified)我检查了文件夹,发现了两个文件,antiword32.exe 和 antiword64.exe
标签: r error-handling text-mining tm read-text