Thursday, September 11, 2014

Box plot

hsb2 <- read.table('http://www.ats.ucla.edu/stat/r/modules/hsb2.csv', header=T, sep=",")
attach(hsb2)


boxplot(write)

boxplot(write, xlab="write", boxwex=.4, 
        col="darkblue")
 
 

boxplot(write ~ ses)

seslab<-as.vector(c("low","medium", "high"))
sesf<-factor(ses, label=seslab)
boxplot(write ~ sesf, xlab="write by ses")

boxplot(write ~ sesf, xlab="write by ses", 
        boxwex=.2, notch = TRUE, 
        col = "darkblue")


# by two factors
boxplot(write ~ female + ses, 
        xlab="write by female and ses", 
        boxwex=.2)
 

  

No comments:

Post a Comment