作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 R 和编程的新手,我正在尝试创建一个程序来收集和分析来自 twitter 的数据。我正在使用的代码如下:
install.packages(c("devtools", "rjson", "bit64", "httr"))
library(devtools)
library(twitteR)
APIkey <- "xxxxxxxxxxxxxxxxxxxxxx"
APIsecret <- "xxxxxxxxxxxxxxxxxxxxxxxxx"
accesstoken <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
accesstokensecret <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
setup_twitter_oauth(APIkey,APIsecret,accesstoken,accesstokensecret)
Pat1$Patientsentiment <- tolower (Pat1$Patientcomment)
library(qdap)
Sent<-polarity(Pat1$Patientcomment, grouping.var = Pat1$Pat.NUMBER,
positive.list = positive.words,
negative.list = negative.words,
negation.list = negation.words,
amplification.list = increase.amplification.words,
rm.incomplete = FALSE, digits = 3)
RPatient_Polarity <- data.frame(Sent$all)
> library(devtools)
> library(twitteR)
> APIkey <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
> APIsecret <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
> accesstoken <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
> accesstokensecret <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
> setup_twitter_oauth(APIkey,APIsecret,accesstoken,accesstokensecret)
[1] "Using direct authentication"
Error in check_twitter_oauth() : OAuth authentication error:
This most likely means that you have incorrectly called
setup_twitter_oauth()'
> Pat1$Patientsentiment <- tolower (Pat1$Patientcomment)
> library(qdap)
> Sent<-polarity(Pat1$Patientcomment, grouping.var = Pat1$Pat.NUMBER,
+
+ positive.list = positive.words,
+
+ negative.list = negative.words,
+
+ negation.list = negation.words,
+
+ amplification.list = increase.amplification.words,
+
+ rm.incomplete = FALSE, digits = 3)
Error in derive_pubkey(key) :
RAW() can only be applied to a 'raw', not a 'list'
> RPatient_Polarity <- data.frame(Sent$all)
Error in data.frame(Sent$all) : object 'Sent' not found
最佳答案
试试 Sent[[all]]
.看看它是否有帮助。
关于r - 如何在 R 中将变量保存为数据帧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40809870/
我是一名优秀的程序员,十分优秀!