Introduction to Statistics (MAT/SST 115.03 2008S)
As always, we start by reading in some values.
DC = read.csv("/home/rebelsky/Stats115/Data/DigitalCameras.csv") head(DC)
As that summary suggests, the five columns in the table are
Score. Now, the book asks us to separate them by
type. Lets check what kinds of types there are.
Well, it looks the the four types are
super-zoom. Each is probably represented as
This problem asks us to summarize the data by type of camera. In order to get summaries, we need to break apart the data according to type. Let's start by creating a vector of prices for each of the four kinds of camera. Note that the price is is column 4, so we can use a selector to get the appropriate rows and then just take column 4. From that vector, we compute the six-number summary.
summary(DC[DC$Type=="advanced compact", 4]) summary(DC[DC$Type=="compact", 4]) summary(DC[DC$Type=="subcompact", 4]) summary(DC[DC$Type=="super-zoom", 4])
In addition to those summaries, we might make boxplots.
If we're going to do aligned boxplots, we need a way to
join those boxplots together. Alternately we can look for
a command to draw multiple boxpots, stacked on top of each
other. Fortunately, the
comes into play here.
Scorecolumn. The particulars of that command are left as an exercise for the reader.
Copyright (c) 2007-8 Samuel A. Rebelsky.
This work is licensed under a Creative Commons
Attribution-NonCommercial 2.5 License. To view a copy of this
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.