代入データのヒストグラムを作成する
geom_miss_point() の最初の可視化を再現できたので、これを他の探索タスクにもどう応用できるか見ていきましょう。
有用なタスクの1つは、ある変数の欠損数をヒストグラムで評価することです。前の演習で作成し、このセッションに読み込まれている ocean_imp_track データセットを使って行います。
この演習はコースの一部です
Rでの欠損データの扱い方
演習の手順
代入と追跡を行ったデータ ocean_imp_track を使って、次を行ってください。
air_temp_cの値を調べ、air_temp_c_NAで欠損量を可視化します。humidityの欠損をhumidity_NAで調べます。- 年ごとの
air_temp_cの欠損を、facet_wrap(~year)を使って可視化します。 - 年ごとの
humidityの欠損を、facet_wrap(~year)を使って可視化します。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Explore the values of air_temp_c, visualizing the amount of missings with `air_temp_c_NA`.
p <- ggplot(___, aes(x = ___, fill = ___)) + ___()
# Expore the missings in humidity using humidity_NA
p2 <- ggplot(___, aes(x = ___, fill = ___)) + ___()
# Explore the missings in air_temp_c according to year, using `facet_wrap(~year)`.
p + facet_wrap(~___)
# Explore the missings in humidity according to year, using `facet_wrap(~year)`.
p2 + facet_wrap(~___)