Introduction to Statistics (MAT/SST 115.03 2008S)
Primary: [Front Door] [Syllabus] [Current Outline] [R] - [Academic Honesty] [Instructions]
Groupings: [Applets] [Assignments] [Data] [Examples] [Handouts] [Labs] [Outlines] [Projects] [Readings] [Solutions]
External Links: [R Front Door] [SamR's Front Door]
Although the book says that the data are stored in the file
Matching, we've separated the data into
three separate files:
MonopoloyPrices.csv,
SnowfallAmounts.csv,
and
QuizPercentages.csv.
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, MonopolyPrices is
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
MonopolyPrices).
hist(MonopolyPrices$MonopolyPrices)
Here's a fine-enough grained histogram that it replicates the dotplot.
hist(MonopolyPrices$MonopolyPrices, breaks=seq(from=0,to=500,step=25))
As you already know, you can get the mean and median separately
with mean and median.
You can also get them together with a host of other information
by using summary.
summary(MonopolyPrices)
Primary: [Front Door] [Syllabus] [Current Outline] [R] - [Academic Honesty] [Instructions]
Groupings: [Applets] [Assignments] [Data] [Examples] [Handouts] [Labs] [Outlines] [Projects] [Readings] [Solutions]
External Links: [R Front Door] [SamR's Front Door]
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
license, visit http://creativecommons.org/licenses/by-nc/2.5/
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.