การแสดงภาพรูปแบบของค่าสูญหาย
มาฝึกแสดงภาพรูปแบบของค่าสูญหายด้วยวิธีต่าง ๆ กัน ได้แก่
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โดยใส่ไว้ใน argumentfacetพร้อมกำหนด 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 = ___)