Word clouds in Shiny

Case Studies: Building Web Applications with Shiny in R

Dean Attali

Shiny Consultant

Word clouds

  • Visual representation of text
  • BIG WORDS = COMMON, small words = rare

chapter4_1_word_clouds_in_shiny.003.png

Case Studies: Building Web Applications with Shiny in R

Word clouds in R - function

  • Created by your friend:

    create_wordcloud(data, num_words = 100, background = "white")
    
  • data: text to use in word cloud

    • Single string:
      • data = "Some very long story"
    • List of strings:
      • data = c("Some very", "long story")
  • num_words: maximum number of words

  • background: background color
Case Studies: Building Web Applications with Shiny in R

Word clouds in R - usage

us_constitution <- "We the People of the United States, ..."

create_wordcloud(data = us_constitution, num_words = 15, background = "yellow")

chapter4_1_word_clouds_in_shiny.012.png

Case Studies: Building Web Applications with Shiny in R

Word clouds: from R to Shiny

  • create_wordcloud() requires R knowledge to use
  • Create Shiny app ⇒ anyone can create a word cloud
Case Studies: Building Web Applications with Shiny in R

Word clouds in Shiny

chapter4_1_word_clouds_in_shiny.016.png

  • Word clouds are new type of output
  • wordcloud2Output() + renderWordcloud2()
Case Studies: Building Web Applications with Shiny in R

Let's practice!

Case Studies: Building Web Applications with Shiny in R

Preparing Video For Download...