使用R(情绪分析)提取推文时出错
在连接到twitter的API并连接到R中的库之后, 接下来是对推文的提取和分析,由于错误,我无法做到这一点。 我使用的代码是使用R(情绪分析)提取推文时出错,r,twitter,twitter-oauth,sentiment-analysis,tweets,R,Twitter,Twitter Oauth,Sentiment Analysis,Tweets,在连接到twitter的API并连接到R中的库之后, 接下来是对推文的提取和分析,由于错误,我无法做到这一点。 我使用的代码是 # The function for extracting and analyzing tweets search <- function(searchterm) { # Extract tweets and create storage file list <- searchTwitter(searchterm, cainfo='cacert.pe
# The function for extracting and analyzing tweets
search <- function(searchterm) {
# Extract tweets and create storage file
list <- searchTwitter(searchterm, cainfo='cacert.pem', n=1500)
df <- twListToDF(list)
df <- df[, order(names(df))]
df$created <- strftime(df$created, '%Y-%m-%d')
if (file.exists(paste(searchterm, '_stack.csv'))==FALSE) {
write.csv(df, file=paste(searchterm, '_stack.csv'), row.names=F)
}
}
#提取和分析推文的功能
搜索您是如何运行函数的?在控制台中,我首先连接了库,然后连接到API,然后使用函数提取推文。我使用这个作为参考,你是如何运行你的函数的?在控制台中,首先我连接了库,然后连接到API,然后使用这个函数提取推文。我用这个作为参考
df <- twListToDF(list)
df <- df[, order(names(df))]
df$created <- strftime(df$created, '%Y-%m-%d')