始める無料で始める

欠損をファセットで探る(複数プロット)

geom_miss_point() で役立つもうひとつのテクニックは、複数のプロットを作って欠損を探索することです。

これまでの演習と同様に、nabular データを使うことで、さらにファセット化したプロットを作成できます。

年などのデータ中の値や、欠損のようなデータの特徴に応じて、複数のファセットプロットを作ることもできます。

この演習はコースの一部です

Rでの欠損データの扱い方

コースを見る

演習の手順

  • geom_miss_point()facet_wrap() を使い、humidity の欠損状態によって wind_ewair_temp_c の欠損がどのように異なるかを探索してください。
  • geom_miss_point()facet_grid() を使い、humidity の欠損状態および year ごとに、wind_ewair_temp_c の欠損がどのように異なるかを探索してください。

実践的なインタラクティブ演習

このサンプルコードを完成させて、この演習に挑戦してみましょう。

# Use geom_miss_point() and facet_wrap to explore how the missingness  
# in wind_ew and air_temp_c is different for missingness of humidity
bind_shadow(oceanbuoys) %>%
  ggplot(aes(x = ___,
           y = ___)) + 
  geom_miss_point() + 
  facet_wrap(~___)

# Use geom_miss_point() and facet_grid to explore how the missingness in wind_ew and air_temp_c 
# is different for missingness of humidity AND by year - by using `facet_grid(humidity_NA ~ year)`
bind_shadow(oceanbuoys) %>%
  ggplot(aes(x = ___,
             y = ___)) + 
  geom_miss_point() + 
  facet_grid(humidity_NA~year)
コードを編集して実行