開始使用免費開始

視覺化遺漏模式

來練習用幾種不同方式來視覺化遺漏值的模式:

  • 使用 gg_miss_upset() 檢視整體的遺漏情形。
  • 使用 gg_miss_fct() 針對含有感興趣類別的資料集(婚姻狀態)。
  • 使用 gg_miss_span() 探索時間序列資料中的遺漏情形。

觀察資料中的遺漏與分面呈現,有哪些值得注意的現象?

本練習屬於課程

在 R 中處理遺漏值

檢視課程

練習說明

  • 使用 gg_miss_upset() 探索 airquality 資料集的遺漏模式。
  • 使用 gg_miss_fct() 探索 riskfactors 資料集中,遺漏情形如何隨 marital 變數改變。
  • pedestrian 資料集中,針對 hourly_counts 變數,以 3000 的區間長度探索遺漏情形(你也可以嘗試 2000–5000 的不同區間)。
  • month 納入 facet 引數,並以 1000 的區間長度,探索 monthhourly_counts 的影響。

動手互動練習

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

# 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 = ___)
編輯並執行程式碼