【发布时间】:2019-07-21 00:32:55
【问题描述】:
我想重现这个情节,但是ggplot2 完成的速度很慢,而且情节最后返回空白。
我的代码:
library(ggplot2)
g <- ggplot(data = bigram_tf_idf2, aes(x = tf_idf, y = bigram)) +
geom_bar(stat = 'identity') +
coord_flip()
g + facet_wrap(~ book, ncol = 2)
样本数据集:
bigram_tf_idf2 <- data.frame(book = c('Persuasion','Mansfield Park','Mansfield Park','Persuasion','Persuasion','Emma','Northanger Abbey','Sense & Sensibility','Emma','Pride & Prejudice'),
bigram = c('captain wentworth','sir thomas','miss crawford','lady russell','sir walter', 'miss woodhouse', 'miss tilney', 'colonel brandon', 'frank churchill', 'lady catherine'),
tf_idf = c(0.0535, 0.0515, 0.0386, 0.0371, 0.0356, 0.0305, 0.0286, 0.0269, 0.0248, 0.0247))
【问题讨论】:
-
欢迎来到 SO。我们无权访问您的数据集。请提供一个最小的可重现示例。请参阅此post 学习。重要的是,您是否尝试过查看本网站上发布的类似问题?我敢肯定有一个类似于你在这里某个地方问过的问题。这里的重点是,发布代码片段是不够的。必须展示解决问题的努力。
-
你是对的!我编辑了我的帖子。
标签: r ggplot2 rstudio visualization data-science