简体   繁体   中英

shiny wordcloud2 json warning and blanck page

I have a shiny app that works perfectly fine in my laptop but when I deploy it to AWS EC2, all work except the word cloud. I want to display cloud of bigrams, trigrams and words. It displays for bigrams and trigrams but not when I choose 'words', it displays nothing. The dataframe has word and freq columns. I checked the logs and it says

Input to asJSON(keep_vec_names=TRUE) is a named vector. In a future version of jsonlite, this option will not be supported, and named vectors will be translated into arrays instead of objects. If you want JSON object output, please use a named list instead. See?toJSON.

Here is the server side code for the word cloud:

output$my_wordcloud <- renderWordcloud2({
req(input$file1)
req(input$token)
token = input$token
token = ifelse(token == 'words', 'word', ifelse(token == 'bigrams', 'bigram', 'trigram'))
df = to_display()
df = df %>% group_by_at(token) %>% summarise(freq = sum(Count))
df = df %>% filter(freq > 1)
wordcloud2(df, size = input$wc_size)
})

I dropped name attribute from my vector, which is used to build one of my dataframes, and it worked. The issue was this line:

stem_completed = stemCompletion(stemmed_unique, words_corpus,"prevalent")

and adding the line below solved it.

stem_completed = unname(stem_completed)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM