12.07.2015 Views

R dummies

R dummies

R dummies

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

oxplot(mpg ~ cyl, data=cars)Figure 14-3: Use the boxplot() function to get this result.You supply a simple formula as the first argument to boxplot(). This formulareads as “plot boxes for the variable mpg for the groups defined by the variablecyl.” You find more information on the formula interface for functions in Chapter13.This plot uses quantiles to give you an idea of how the data is spread withineach subgroup. The line in the middle of each box represents the median, and theedges of the box represent the first and the third quartiles. The whiskers extend toeither the minimum and the maximum of the data or 1.5 times the distancebetween the first and the third quartiles, whichever is smaller.To be completely correct, the edges of the box represent the lower andupper hinges from the five-number summary, calculated using the fivenum()function. They’re equal to the quartiles only if you have an odd number ofobservations in your data. Otherwise, the results of fivenum() and quantile()may differ a bit due to differences in the details of the calculation.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!