问题描述
我怀疑对于比我更有经验的程序员来说,这是一个相当简单的问题。
我正在做情绪分析,比较两家公司的评论情绪,我正在使用 Silge 等人 (2021) 的“tidytext 简介”和 Jane Austin 示例作为抵消。
我使用了两家名为 Hawes、Curtis 和 Indochino 的公司,而不是跨账本进行分析。
这是论文中的代码:
bing <- get_sentiments("bing")
janeaustensentiment <- tidy_books %>%
inner_join(bing) %>%
count(book,index = line %/% 80,sentiment) %>%
spread(sentiment,n,fill = 0) %>%
mutate(sentiment = positive - negative)
library(ggplot2)
ggplot(janeaustensentiment,aes(index,sentiment,fill = book)) +
geom_bar(stat = "identity",show.legend = FALSE) +
facet_wrap(~book,ncol = 2,scales = "free_x")
这是我的代码:
bing <- get_sentiments("bing")
all_sentiment <- tokens_all %>%
inner_join( bing) %>%
count(company,index=line %/% 60,sentiment) %>%
spread(sentiment,fill = 0) %>%
mutate(sentiment = positive - negative)
ggplot(all_sentiment,fill= company)) +
geom_bar(stat = "identity",show.legend = FALSE)
facet_wrap(~company,scales = "free_x")
如果您需要可重现的示例,请告诉我。
谢谢
安德斯
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)