Shiny 的文字雲

案例研究:使用 R 的 Shiny 建置網頁應用程式

Dean Attali

Shiny Consultant

文字雲

  • 文字的視覺呈現
  • 大字=常見,小字=罕見

章節4_1_shiny_中的文字雲.003.png

案例研究:使用 R 的 Shiny 建置網頁應用程式

R 的文字雲—函式

  • 你的朋友寫的函式:

    create_wordcloud(data, num_words = 100, background = "white")
    
  • data:用於文字雲的文字

    • 單一字串:
      • data = "Some very long story"
    • 多個字串:
      • data = c("Some very", "long story")
  • num_words:最多顯示的詞數

  • background:背景顏色
案例研究:使用 R 的 Shiny 建置網頁應用程式

R 的文字雲—用法

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

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

章節4_1_shiny_中的文字雲.012.png

案例研究:使用 R 的 Shiny 建置網頁應用程式

文字雲:從 R 到 Shiny

  • 使用 create_wordcloud() 需要 R 基礎
  • 做成 Shiny 應用 ⇒ 人人都能產生文字雲
案例研究:使用 R 的 Shiny 建置網頁應用程式

Shiny 的文字雲

章節4_1_shiny_中的文字雲.016.png

  • 文字雲是新的輸出型態
  • wordcloud2Output() + renderWordcloud2()
案例研究:使用 R 的 Shiny 建置網頁應用程式

一起來練習吧!

案例研究:使用 R 的 Shiny 建置網頁應用程式

Preparing Video For Download...