从Reddit中删除时,参数的列数不匹配

从Reddit中删除时,参数的列数不匹配,r,web-scraping,sentiment-analysis,R,Web Scraping,Sentiment Analysis,我的项目是分析音乐专辑的数据。我已经有了一个包含信息的数据框,通过这个循环,我打算从reddit评论中提取情感,然后从与专辑相关的所有评论中提取平均值,并将其逐行插入初始数据框 ###Create an empty df to fill with the new values df = data.frame() for (i in lista[1:2050]) { Sys.sleep(5) ###Scraping the comments prueba<- RedditExtr

我的项目是分析音乐专辑的数据。我已经有了一个包含信息的数据框,通过这个循环,我打算从reddit评论中提取情感,然后从与专辑相关的所有评论中提取平均值,并将其逐行插入初始数据框


###Create an empty df to fill with the new values
df = data.frame()
for (i in lista[1:2050]) {
  Sys.sleep(5)

###Scraping the comments
  prueba<- RedditExtractoR::get_reddit(search_terms = lista[i], subreddit = "music",cn_threshold=10)
  
### Getting the sentiment from the comments
sent<- sentimentr::sentiment(prueba$comment, polarity_dt = lexicon::hash_sentiment_jockers_rinker)
  meansent<- mean(sent$sentiment)
  print(i)
 
 databasetodo = rbind(databasetodo, data.frame(meansent, stringsAsFactors = FALSE))

  }

###创建一个空df以填充新值
df=data.frame()
(我在列表[1:2050]中){
系统睡眠(5)
###删除评论

Prueba这两个数据集的维度是什么?
dim(databasetodo)
dim(data.frame(meansent,stringsAsFactors=FALSE))
以及是否需要
cbind()
函数而不是
rbind()
dim(databasetodo)[1]2050 19 dim(data.frame(meansent,stringsAsFactors=FALSE))[1]1.我试过cbind()以前,但它附加了多个具有相同值的列,而不是每行具有不同值的列。我只是尝试使用您的代码,唯一的问题是在第1行,您调用空的data.frame
df
,而稍后在您的代码中,您尝试更新data.frame
databasetodo
。我创建了自己的搜索词,并使用t他认为密码是有效的。你介意分享你的密码吗?我不能用你的观察让它起作用