Nabular 데이터와 결측 여부별 요약
이 연습에서는 nabular 데이터를 활용해 한 변수의 결측 여부에 따라 다른 변수의 분포가 어떻게 달라지는지 살펴보겠습니다.
naniar의 oceanbuoys 데이터셋을 사용하고, 패싯을 이용해 여러 개의 플롯을 만들어요.
이를 통해 결측이 갖는 서로 다른 층위를 탐색할 수 있습니다.
이 연습은 강의의 일부입니다
R에서 결측치 다루기
연습 안내
- 공기 온도의 결측 여부(
air_temp_c_NA)에 따라 동서풍(wind_ew)의 분포를geom_density()로 살펴보고, 공기 온도의 결측 여부(air_temp_c_NA)로 패싯하세요. - 여기에서 한 걸음 더 나아가 습도 결측 여부(
humidity_NA)로 채우기 색을 지정해 시각화를 확장하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Explore the distribution of wind east west (wind_ew) for the missingness of air temperature
# using geom_density() and faceting by the missingness of air temperature (air_temp_c_NA).
___ %>%
bind_shadow(___) %>%
ggplot(aes(x = ___)) +
geom_density() +
facet_wrap(~___)
# Build upon this visualization by coloring by the missingness of humidity (humidity_NA).
___ %>%
___(___) %>%
ggplot(aes(x = ___,
color = ___)) +
geom_density() +
___(~___)