결측 패턴 시각화하기
다음 함수를 사용해 다양한 방식으로 결측 패턴을 시각화해 보세요.
- 전체적인 결측 패턴을 살피는
gg_miss_upset(). - 관심 요인인 marriage가 있는 데이터셋에 쓰는
gg_miss_fct(). - 시계열 데이터셋의 결측을 탐색하는
gg_miss_span().
결측과 패싯팅(faceting) 결과에서 무엇이 보이나요?
이 연습은 강의의 일부입니다
R에서 결측치 다루기
연습 안내
gg_miss_upset()으로airquality데이터셋의 결측 패턴을 탐색하세요.gg_miss_fct()로riskfactors데이터셋에서marital변수에 따라 결측이 어떻게 달라지는지 살펴보세요.gg_miss_span()으로pedestrian데이터셋에서hourly_counts변수의 결측이 구간 3000에서 어떻게 변하는지 탐색하세요(2000–5000 범위의 다른 구간도 시도해 보세요).- 구간을 1000으로 설정하고,
facet인수에month를 포함해hourly_counts에 대한month의 영향을 탐색하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# 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 = ___)