開始使用免費開始

視覺化寶可夢

來試著視覺化寶可夢資料吧。pokemon 資料集中有很多變數,所以先只挑幾個我們真的想拿來當作 cognostics 的變數。

本練習屬於課程

使用 R 的 Trelliscope 視覺化巨量資料

檢視課程

練習說明

  • 使用 dplyr 的 select(),將資料集的變數縮減為 pokemontype_1attackgeneration_idurl_image
  • 重新指定變數 pokemon,用 cog() 讓寶可夢的名稱預設會在顯示中作為標籤出現。
  • 指定一個新變數 panel,讓 trelliscope 以 url_image 變數作為面板繪圖來源。
  • 使用 trelliscope() 建立顯示,將其命名為 "pokemon",並將預設版面設為 3 列 6 行。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

library(dplyr)
library(trelliscopejs)

# Create a new data frame to use for plotting
pokemon2 <- pokemon %>%
  # Reduce the variables in the dataset
  select(pokemon, type_1, attack, generation_id, url_image) %>%
  mutate(
    # Respecify pokemon
    pokemon = cog(val = ___, default_label = ___),
    # Create panel variable
    panel = img_panel(___)
  )

# Create the display
trelliscope(pokemon2, ___)
編輯並執行程式碼