【发布时间】:2022-01-11 18:45:55
【问题描述】:
我正在尝试在 R 中进行 Reddit 情绪分析。我无法克服错误,我正在尝试解决问题。
# Getting Reddit Data
links<- find_thread_urls(
keywords = "Ghostbusters",
sort_by = "top",
subreddit = NA,
period = "all"
)
# function to iterate through all posts
funct = function(i){
content = get_thread_content()(links$URL[i])
com = iconv(content$comment, to = 'utf-8')
clov = get_nrc_sentiment(com)
x1 = 100*colSums(clov)/sum(clov)
return(cbind(links[i,], t(x1) ))
}
# list of all the links
ls = 1:nrow(links)
# loop through all the links and bind to a data frame
res = do.call("rbind", lapply(ls, funct))
当我运行这段代码时,我得到了这个错误:
Error in lapply(urls, parse_thread_url) :
argument "urls" is missing, with no default
我在这里错过了什么?
【问题讨论】:
-
错误信息是不言自明的。函数
parse_thread_url需要一个参数url而你还没有提供它。
标签: r sentiment-analysis reddit