Introduction to Statistics (MAT/SST 115.03 2008S)
Although the book says that the data are stored in the file
Matching, we've separated the data into
three separate files:
All are stored in the standard data directory for this course.
Recall that you can read a file into a frame with a command like
MonopolyPrices = read.csv("/home/rebelsky/Stats115/Data/MonopolyPrices.csv")
You should be able to figure out the commands to read the other two data sets.
We need to load an appropriate library to do dotplots, but otherwise it remains straightforward. Particularly since we do not plan to use these graphs for anything but a quick observation, we don't even need to fool with axis labels.
library(BHH2, lib="/home/rebelsky/Stats115/Packages") dotPlot(MonopolyPrices, main="Prices of Monopoly Properties")
You might note something a bit strange about this command.
Traditionally, we use
dotPlot with vectors.
And, if you think about it carefully,
a data frame, rather than a vector. So, why does the command work?
Apparantly, R is smart enough to treat a data frame with one column
as a vector, at least for this plot.
If, however, you want to create a histogram, you'll need to
extract the column (which is also called
Here's a fine-enough grained histogram that it replicates the dotplot.
As you already know, you can get the mean and median separately
You can also get them together with a host of other information
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.