From 2ed50d0f5a7d728d870d0ec718318e4bb83e5b95 Mon Sep 17 00:00:00 2001 From: Rafael Schlatter Date: Sun, 8 Oct 2017 20:21:38 +0200 Subject: [PATCH] added R commands for poxplots I added R code producing boxplots in question 8c) part iii) and iv) in chapter 2. --- ch2/applied.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ch2/applied.R b/ch2/applied.R index 7cdc327..8845ab8 100644 --- a/ch2/applied.R +++ b/ch2/applied.R @@ -12,6 +12,9 @@ summary(college) pairs(college[,1:10]) # iii. plot(college$Private, college$Outstate) +Private.1 <- as.factor(Private) +college <- data.frame(college, Private.1) +boxplot(college$Outstate, college$Private.1) # iv. Elite = rep("No", nrow(college)) Elite[college$Top10perc>50] = "Yes" @@ -19,6 +22,7 @@ Elite = as.factor(Elite) college = data.frame(college, Elite) summary(college$Elite) plot(college$Elite, college$Outstate) +boxplot(college$Outstate, college$Elite) # v. par(mfrow=c(2,2)) hist(college$Apps)