중년기, 노년기 한국인의 신장 길이를 성별, 나이별로 분석해 보았습니다. 우선 전체적인 신장 분포입니다.
health <- read.csv("./data/NHIS_OPEN_GJ_2016.csv",
header = TRUE,
stringsAsFactors = FALSE)
barplot(table(health$신장.5Cm단위.),col='yellow')
155cm에서 175cm사이가 가장 많습니다.
전체 신장의 평균입니다.
mean(health$신장.5Cm단위.,na.rm=TRUE
)
## [1] 162.3867
남성, 여성으로 성별을 나눠 신장을 분석해 보았습니다.
남성의 키 분포입니다.
health.m <- health[health$성별코드 ==1,]
barplot(table(health.m$신장.5Cm단위.), col='yellow')
170cm가 가장 많습니다.
남성의 키 평균입니다.
mean(health.m$신장.5Cm단위.,na.rm=TRUE
)
## [1] 168.6729
전체 평균인 162.3867409보다 높습니다.
여성의 키 분포입니다.
health.w <- health[health$성별코드 ==2,]
barplot(table(health.w$신장.5Cm단위.), col='yellow')
155cm가 가장 많습니다.
여성의 키 평균입니다.
mean(health.w$신장.5Cm단위.,na.rm=TRUE
)
## [1] 155.2048
전체 평균인 162.3867409보다 낮습니다.
나이별로 전체 신장분포를 분석해 보았습니다.
install.packages( "tidyverse",
repos="https://cran.seoul.go.kr")
## Installing package into 'C:/Users/bogyu/Documents/R/win-library/3.5'
## (as 'lib' is unspecified)
## package 'tidyverse' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\bogyu\AppData\Local\Temp\RtmpqIcSZd\downloaded_packages
library( tidyverse )
## -- Attaching packages -------------------------------------------------------------------------------------------------- tidyverse 1.2.1 --
## √ ggplot2 3.0.0 √ purrr 0.2.5
## √ tibble 1.4.2 √ dplyr 0.7.6
## √ tidyr 0.8.1 √ stringr 1.3.1
## √ readr 1.1.1 √ forcats 0.3.0
## -- Conflicts ----------------------------------------------------------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
ggplot(data=health) + geom_point(aes(x=연령대코드.5세단위.,y=신장.5Cm단위.),color='yellow',
position='jitter')
## Warning: Removed 897 rows containing missing values (geom_point).
연령이 늘어나면서 키가 작아지는 경향을 보입니다.
남성의 신장분포를 나이별로 분석해 보았습니다.
ggplot(data=health.m) + geom_point(aes(x=연령대코드.5세단위.,y=신장.5Cm단위.),color='yellow',
position='jitter')
## Warning: Removed 517 rows containing missing values (geom_point).
연령이 늘어나면서 키가 작아지는 경향을 보입니다.
여성의 신장분포를 나이별로 분석해 보았습니다.
ggplot(data=health.w) + geom_point(aes(x=연령대코드.5세단위.,y=신장.5Cm단위.),color='yellow',
position='jitter')
## Warning: Removed 380 rows containing missing values (geom_point).
연령이 늘어나면서 키가 작아지는 경향을 보입니다.
전체 신장분포를 나이와 성별로 분석해 보았습니다.
ggplot(data=health) + geom_point(aes(x=연령대코드.5세단위., y=신장.5Cm단위., color =성별코드),
position='jitter')
## Warning: Removed 897 rows containing missing values (geom_point).
여성에 비해 남성이 키가 더 크고, 나이가 늘어남에 따라 키가 감소하는 경향이 있습니다.