#±âÃâ¹®Á¦ # ÀÛ¾÷Çü Á¦ 1À¯Çü .libPaths("C:/myRproject/Library") #1¹ø ¹®Á¦ install.packages("mlbench") library(mlbench) data(BostonHousing) df<-BostonHousing str(df) library(dplyr) df_1<- df %>% arrange(desc(crim)) df_1[1:10,1]<-df_1[10,1] result <- df_1 %>% filter(age>=80) %>% summarise(mean=mean(crim)) print(result) #2¹ø ¹®Á¦ df<-read.csv("https://raw.githubusercontent.com/ageron/handson-ml/master/datasets/housing/housing.csv") str(df) summary(df) train<-df[c(1:nrow(df)*0.8),] sd_1<- sd(train$total_bedrooms, na.rm=T) sd_2<-train %>% mutate(new = ifelse(is.na(total_bedrooms), median(total_bedrooms, na.rm=T), total_bedrooms)) %>% summarise(sd=sd(new)) print(abs(sd_1-sd_2)) #3¹ø ¹®Á¦ df<-read.csv("https://raw.githubusercontent.com/stedy/Machine-Learning-with-R-datasets/d20658ec6d336af2d4ddb5fd72b6f677dd46136e/insurance.csv") str(df) summary(df) fivenum(df$charges) low <- fivenum(df[,7])[2] - 1.5*IQR(df[,7]) upp <- fivenum(df[,7])[4] + 1.5*IQR(df[,7]) fivenum(df[,7]) which(df[,7]=upp | df[,7]<=low),7]) print(result)