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

การแสดงภาพรูปแบบของค่าสูญหาย

มาฝึกแสดงภาพรูปแบบของค่าสูญหายด้วยวิธีต่าง ๆ กัน ได้แก่

  • gg_miss_upset() เพื่อดูภาพรวมของรูปแบบค่าสูญหาย
  • gg_miss_fct() สำหรับชุดข้อมูลที่มี factor ที่สนใจ คือ marriage
  • และ gg_miss_span() เพื่อสำรวจค่าสูญหายในชุดข้อมูลอนุกรมเวลา

สังเกตเห็นอะไรบ้างเกี่ยวกับค่าสูญหายและการ facet ในข้อมูล?

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

การจัดการข้อมูลที่หายไปใน R

ดูคอร์ส

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

  • สำรวจรูปแบบค่าสูญหายของชุดข้อมูล airquality ด้วย gg_miss_upset()
  • สำรวจว่าค่าสูญหายเปลี่ยนแปลงอย่างไรในชุดข้อมูล riskfactors ตามตัวแปร marital โดยใช้ gg_miss_fct()
  • สำรวจว่าค่าสูญหายเปลี่ยนแปลงอย่างไรในชุดข้อมูล pedestrian ตามตัวแปร hourly_counts โดยใช้ span 3000 (ลองปรับค่า span ระหว่าง 2000-5000 ก็ได้)
  • สำรวจผลกระทบของ month ต่อ hourly_counts โดยใส่ไว้ใน argument facet พร้อมกำหนด span เป็น 1000

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# Using the airquality dataset, explore the missingness pattern using gg_miss_upset()
gg_miss_upset(airquality)

# With the riskfactors dataset, explore how the missingness changes across the marital variable using gg_miss_fct()
gg_miss_fct(x = riskfactors, fct = marital)

# Using the pedestrian dataset, explore how the missingness of hourly_counts changes over a span of 3000 
gg_miss_span(pedestrian, var = ___, span_every = ___)

# Using the pedestrian dataset, explore the impact of month by faceting by month
# and explore how missingness changes for a span of 1000
____(___, var = ___ , span_every = ___, facet = ___)
แก้ไขและรันโค้ด