Saturday, September 6, 2008

Using the LearnEDA package

I'm starting to grade your first R homework.   I wrote the LearnEDA package to make it easier for you to read in datasets and do some basic calculations.  

If you look at the R folder in the Course Documents section of Blackboard, you'll see the appropriate R commands for each topic. 

FOR EACH HOMEWORK, MAKE SURE YOU LOOK AT THE R FOLDER SO YOU KNOW
THE COMMANDS YOU NEED TO USE.

In the first homework, you were supposed to read in the baseball attendance data and compute some letter values. 

Here's how you do this in R using the LearnEDA package.  (I'm assuming you have already installed this package.)

This loads the package.

> library(LearnEDA)

Read in the dataset:

> data(baseball.attendance)

Attach the data to make the variable names available:

> attach(baseball.attendance)

Compute letter values:

> lval(Home.Attendance)
  depth      lo      hi     mids spreads
1  15.5 32783.5 32783.5 32783.50     0.0
2   8.0 23704.0 36164.0 29934.00 12460.0
3   4.5 21614.5 40166.0 30890.25 18551.5
4   2.5 16574.0 41010.0 28792.00 24436.0
5   1.0  8651.0 42067.0 25359.00 33416.0



No comments: