視覺化寶可夢
來試著視覺化寶可夢資料吧。pokemon 資料集中有很多變數,所以先只挑幾個我們真的想拿來當作 cognostics 的變數。
本練習屬於課程
使用 R 的 Trelliscope 視覺化巨量資料
練習說明
- 使用 dplyr 的
select(),將資料集的變數縮減為pokemon、type_1、attack、generation_id和url_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, ___)