# R notes for Activity 8-3: Matching Game

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

You should be able to figure out the commands to read the other two data sets.

## Dot Plots

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))

## Numeric Measures

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)

Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright (c) 2007-8 Samuel A. Rebelsky.