산점도를 이용한 시각화

R로 하는 설문 데이터 분석

Kelly McConville

Assistant Professor of Statistics

babies <- filter(NHANESraw, AgeMonths <= 6) %>%
  select(AgeMonths, HeadCirc)
babies
# A tibble: 484 x 2
   AgeMonths HeadCirc
       <int>    <dbl>
 1         3     42.7
 2         4     42.8
 3         2     38.8
 4         0     36.0
 5         5     42.7
 6         2     41.9
 7         6     44.3
 8         3     42.0
 9         2     41.3
10         1     38.9
# ... with 474 more rows
R로 하는 설문 데이터 분석

산점도

ggplot(data = babies, mapping = aes(x = AgeMonths, y = HeadCirc)) + 
  geom_point()

나이 대 머리 둘레 산점도

R로 하는 설문 데이터 분석

지터링

ggplot(data = babies, mapping = aes(x = AgeMonths, y = HeadCirc)) + 
  geom_jitter(width = 0.3, height = 0)

지터링된 나이 대 머리 둘레 산점도

R로 하는 설문 데이터 분석
babies <- filter(NHANESraw, AgeMonths <= 6) %>%
  select(AgeMonths, HeadCirc, WTMEC4YR)
babies
# A tibble: 484 x 3
   AgeMonths HeadCirc WTMEC4YR
       <int>    <dbl>    <dbl>
 1         3     42.7    12915
 2         4     42.8    12791
 3         2     38.8     2359
 4         0     36.0     4306
 5         5     42.7     2922
 6         2     41.9     5561
 7         6     44.3    10416
 8         3     42.0     9957
 9         2     41.3     4503
10         1     38.9     3718
# ... with 474 more rows
R로 하는 설문 데이터 분석

버블 플롯

ggplot(data = babies, mapping = aes(x = AgeMonths, y = HeadCirc,
                                    size = WTMEC4YR)) + 
  geom_jitter(width = 0.3, height = 0) + 
  guides(size = "none")

나이 대 머리 둘레 버블 플롯

R로 하는 설문 데이터 분석

버블 플롯

ggplot(data = babies, mapping = aes(x = AgeMonths, y = HeadCirc,
                                    size = WTMEC4YR)) + 
  geom_jitter(width = 0.3, height = 0, alpha = 0.3) + 
  guides(size = "none")

반투명 점이 있는 나이 대 머리 둘레 버블 플롯

R로 하는 설문 데이터 분석

가중치 반영 산점도

ggplot(data = babies, mapping = aes(x = AgeMonths, y = HeadCirc,
                                    color = WTMEC4YR)) + 
  geom_jitter(width = 0.3, height = 0) + 
  guides(color = "none")

색상으로 체중을 나타낸 나이 대 머리 둘레 산점도

R로 하는 설문 데이터 분석

가중치 반영 산점도

ggplot(data = babies, mapping = aes(x = AgeMonths, y = HeadCirc,
                                    alpha = WTMEC4YR)) + 
  geom_jitter(width = 0.3, height = 0) + 
  guides(alpha = "none")

투명도로 체중을 나타낸 나이 대 머리 둘레 산점도

R로 하는 설문 데이터 분석

연습해 봅시다!

R로 하는 설문 데이터 분석

Preparing Video For Download...