如何在R中渲染wordcloud?
在浏览过程中,我必须在shiny的主面板中呈现如何在R中渲染wordcloud?,r,shiny,R,Shiny,在浏览过程中,我必须在shiny的主面板中呈现wordcloud输出 以下几行定义了我必须渲染的worldcloud: i <- 1 cloud.data <- sort(result$topics[i, ], decreasing = TRUE)[1:50] wordcloud(names(cloud.data), freq = cloud.data, scale = c(4, 0.1), min.freq = 1, rot.per = 0, random.order =
wordcloud
输出
以下几行定义了我必须渲染的worldcloud:
i <- 1
cloud.data <- sort(result$topics[i, ], decreasing = TRUE)[1:50]
wordcloud(names(cloud.data), freq = cloud.data, scale = c(4, 0.1), min.freq = 1,
rot.per = 0, random.order = FALSE)
然后我修正了一些参数(例如,min.freqs
的min.freq
),现在得到以下错误:
shiny::runApp('~/RProject/dynamic_UI')
Listening on http://127.0.0.1:3358
Read 8265 items
Error in if (grepl(tails, words[i])) ht <- ht + ht * 0.2 :
argument is of length zero
Warning in run(timeoutMs) :
is.na() applied to non-(list or vector) of type 'NULL'
shinny::runApp(“~/RProject/dynamic\u UI”)
倾听http://127.0.0.1:3358
阅读8265项
if(grepl(tails,words[i])ht中出错我的列的名称不匹配:应该是testdoc5$word,但我有testdoc5$doc。现在它工作了 wordcloud在Shiny外的渲染是否正确?是@kristang,在Shiny外工作正常。抱歉@kristang在更正后,一些参数如min.freqs应该是min.freq,我得到了错误,我已经更新了。不熟悉wordcloud
,但我可以看到grepl
正在抛出错误,因此,很可能是输入文本字符串中的某些内容导致了问题。thanxh@kristang我有输出问题。。用我的wordcloud函数,我解决了这个问题,我应该删除我的问题吗?
shiny::runApp('~/RProject/dynamic_UI')
Listening on http://127.0.0.1:3358
Read 8265 items
Error in if (grepl(tails, words[i])) ht <- ht + ht * 0.2 :
argument is of length zero
Warning in run(timeoutMs) :
is.na() applied to non-(list or vector) of type 'NULL'