開始使用免費開始

使用 nabular 資料在範圍下方進行插補

我們希望能追蹤自己插補過的數值。若不這麼做,就很難評估插補結果的品質。

我們要練習插補資料,並透過將數值插補到資料範圍以下,重現前面練習中的視覺化。

這樣做能更進一步探索遺漏情形,也同時提供插補遺漏值的基本框架。

首先,使用 impute_below_all() 將資料插補到範圍以下,接著進行視覺化。我們會注意到,雖然這次能看出遺漏值的位置,但仍需要某種方法來追蹤它們。追蹤遺漏資料的程式設計樣式可以協助你達成這件事。

本練習屬於課程

在 R 中處理遺漏值

檢視課程

練習說明

使用 oceanbuoys 資料:

  • 使用 impute_below_all() 將數值插補到資料範圍以下。
  • 視覺化新的遺漏值:x 軸放 wind_ew、y 軸放 air_temp_c
  • 使用 bind_shadow()impute_below_all()add_label_shadow() 進行插補並追蹤資料。
  • 繪製圖形並檢查插補後的數值。

動手互動練習

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

# Impute the oceanbuoys data below the range using `impute_below`.
ocean_imp <- impute_below_all(___)

# Visualize the new missing values
ggplot(___, 
       aes(x = ___, y = ___)) +  
  geom_point()

# Impute and track data with `bind_shadow`, `impute_below_all`, and `add_label_shadow`
ocean_imp_track <- bind_shadow(___) %>% 
  ___() %>% 
  ___()

# Look at the imputed values
___
編輯並執行程式碼