John Verzani's Web Page

This directory contains the Kitchens' data sets in R's format. They can be read in as follows:

  • directly with a command like, as in

    source("http://www.math.csi.cuny.edu/verzani/classes/MTH214/DataSets/abbey.R")

    which reads in the abbey data set.

  • Alternately, you can copy and paste this function into your R session:
     getdata = function(x) {   front = "http://www.math.csi.cuny.edu/verzani/classes/MTH214/DataSets/"   end = ".R"   url = paste(front, tolower(x), end, sep="")   source(url) } 
    Then you can use this function as follows

    getdata("abbey")

    The advantage here is that this function will be saved between sessions so only needs to be entered once.

The data sets have a filename, such as abbey.R, that when sourced creates a variable with some name in the R session, in this case ABBEY. To see which name, you can try the command

 ls() 
Typing ABBEY produces its values:

ABBEY

$$price [1] 296 296 300 302 300 304 303 299 293 294 294 293 295 287 288 297 305 307 307[20] 304 303 304 304 309 309 309 307 306 304 300 296 301 298 295 295 293 292 297[39] 294 293 306 303 301 303 308 305 302 301 297 299 </PRE> The extra <b>$$

price says that ABBEY contains a variable price. This can be accessed by attaching ABBEY with the command

attach(ABBEY)

Now price can be used by name. For instance, to make a histogram of the abbey data:

getdata("abbey") attach(ABBEY) hist(price)

The dealers data set has two variables "Replace" and "Recomnd." These commands will produce a scatterplot:

getdata("dealers") attach(DEALERS) plot(Replace, Recomnd)

or

getdata("dealers") plot(Recomnd ~ Replace, data=DEALERS)