我正在尝试在R中安装pattern.nlp包,但是在进行时会出现几个错误。这个包用于python库,所以我改变了环境变量的路径。但在运行以下代码时,我收到错误。
$
x <- pattern_sentiment("i really really hate iphones", language = "english")
Error in data.table::setDF(score) :
All elements in argument 'x' to 'setDF' must be of same length
In addition: Warning messages:
1: In pyConnectionCheck() : R isn't connected to Python!
2: In pyConnectionCheck() : R isn't connected to Python!
3: In pyConnectionCheck() : R isn't connected to Python!
4: In pyConnectionCheck() : R isn't connected to Python!
$
答案 0 :(得分:0)
使用pyIsConnected()函数检查Python是否从R连接。如果没有,则使用pyConnect()建立连接。
还要确保在Python中安装了pattern.nlp包 - 请参阅http://www.clips.ua.ac.be/pattern