5장 문제 분석 도전! 123p
library(ggplot2)
library(dplyr)
# 5장 문제 분석 도전! 123p
# 문제 1
midwest <- as.data.frame(ggplot2::midwest)
# 문제 2
midwest <- rename(midwest, total=poptotal)
midwest <- rename(midwest, asian=popasian)
midwest
# 문제 3
midwest$percentage <- midwest$asian/midwest$total *100
midwest$percentage
hist(midwest$percentage)
#문제 4
midwest$mean <- mean(midwest$percentage)
midwest$test <- ifelse(midwest$percasian >= midwest$mean, "large","small")
head(midwest)
#문제 5
table(midwest$test)
qplot(midwest$test)