R BOX PLOT
- In R, boxplot (and whisker plot) is created using the boxplot() function.
- The boxplot() function takes in any number of numeric vectors, drawing a boxplot for each vector.
- You can also pass in a list (or data frame) with numeric vectors as its components. Let us use the
- Built-in dataset airquality which has “Daily air quality measurements in New York, May to September 1973.”-R documentation.
- We take the airquality dataset for the implementation of the boxplot
data(airquality)
- We wil use the str() to check the structure of the dataset
str(airquality)
## 'data.frame': 153 obs. of 6 variables:
## $ Ozone : int 41 36 12 18 NA 28 23 19 8 NA ...
## $ Solar.R: int 190 118 149 313 NA NA 299 99 19 194 ...
## $ Wind : num 7.4 8 12.6 11.5 14.3 14.9 8.6 13.8 20.1 8.6 ...
## $ Temp : int 67 72 74 62 56 66 65 59 61 69 ...
## $ Month : int 5 5 5 5 5 5 5 5 5 5 ...
## $ Day : int 1 2 3 4 5 6 7 8 9 10 ...
- We will make the box plot for the ozone reading
boxplot(airquality$Ozone)

INTERPRETATIONS FROM THE DATA PLOT
- We can see that data above the median is more dispersed.
- We can also notice two outliers at the higher extreme.
MAKING THE PLOT MORE MEANINGFUL
boxplot(airquality$Ozone,main="Mean ozone in parts per billion",xlab="Parts per Billion (ppb)",ylab="Ozone",col="RED",border="BLACK",horizontal=T,notch=T)
