เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

การแสดงภาพข้อมูล Pokemon

มาลองแสดงภาพข้อมูล Pokemon กัน ชุดข้อมูล pokemon มีตัวแปรจำนวนมาก ดังนั้นเราจะเลือกเฉพาะตัวแปรที่ต้องการใช้เป็น cognostics เท่านั้น

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

การแสดงภาพข้อมูลขนาดใหญ่ด้วย Trelliscope ใน R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • ลดตัวแปรในชุดข้อมูลให้เหลือเฉพาะ pokemon, type_1, attack, generation_id และ url_image โดยใช้ select() ของ dplyr
  • กำหนดตัวแปร pokemon ใหม่เพื่อให้ชื่อของ Pokemon แสดงเป็น label ใน display โดยค่าเริ่มต้น โดยใช้ฟังก์ชัน cog()
  • กำหนดตัวแปรใหม่ชื่อ panel เพื่อชี้ให้ trelliscope ใช้ตัวแปร url_image สำหรับการ plot panel
  • สร้าง display ด้วย 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, ___)
แก้ไขและรันโค้ด