# simulate data and get at least one outlier
y <- rnorm(100,50,10)
y[1] <- 90
# -----------------------------
# boxplot for a single variable
# -----------------------------
# standard horizontal boxplot with all defaults
color.boxplot(y)
# vertical boxplot with plum color
color.boxplot(y, horizontal=FALSE, col.box="plum")
# boxplot with outliers more strongly highlighted
color.boxplot(y, col.point="red", xlab="My Variable")
# ----------------------------------
# boxplots across multiple variables
# ----------------------------------
# read data into data frame called mydata
#rad("http://web.pdx.edu/~gerbing/data/employees2.csv")
# boxplots for all numeric variables in data frame called mydata
#color.boxplot()
# boxplots for all numeric variables in data frame called mydata
# with specified options
#color.boxplot(col.box="palegreen1", col.point="plum", show.values=TRUE)
# Use the subset function to specify a variable list
#color.boxplot(subset(mydata, select=c(Age,HealthPlan)))
Run the code above in your browser using DataLab