본문 바로가기
공부/R Programming

Data Science Week 10

by 혼밥맨 2021. 5. 3.
반응형

Data Science Week 10

 

Using continuous variable as input variable

- Now we take a continuous variable "age" as predictor (input variable) to make prediction

- To use 'age' variable for prediction, we convert it into range variable 'age_group', which contains under 20, 20s, 30s, 40s, 50s, over60

 

summary(adult$age)

 

adult.train$age_group <- cut(adult.train$age, breaks = c(0, 20, 30, 40, 50, 60, Inf), labels = c('under20', '20s', '30s', '40s', '50s', 'over60'), right = F)

 

// right =T (20, 30]

// right = F [20, 30) 오른쪽 포함? False

 

table(adult.train$age_group)

 

 

 

 

 

 

 

반응형

'공부 > R Programming' 카테고리의 다른 글

Data Science Week 09  (0) 2021.05.03
pums.sample R  (0) 2021.04.17
[Week 06] Lectures  (0) 2021.04.09
[Week 04] Lectures  (0) 2021.03.28
[Week 03] Lectures  (0) 2021.03.28

댓글