My own notes on using R for CDA (pdf file) are definitely a work in progress. As I have time I will also make the corresponding scripts available in the list at the bottom of this page.

Here are some useful sources of R-related information and software:

- My notes on installing R on a PC.
- CRAN: The Comprehensive R Archive Network. Where to find everything that has anything to do with R.
- Frequently Asked Questions for R for Windows: The R Windows FAQ. This will tell you how to install and use R on a Windows PC.
- R Tutorials
*An Introduction to R*(pdf file), by the R Core Development Team. This is an update of*Notes on R: A Programming Environment for Data Analysis and Graphics*, originally by Bill Venables and Dave Smith.*Data Analysis and Graphics Using R - An Introduction*, by John Maindonald. There are also some accompanying datasets and scripts.

Here are some R scripts to reproduce some of the computations done in class. You can either enter these commands one line at a time into the R window on your PC, or you can copy the whole thing into the Rweb code window and submit it. Lines that start with the # symbol are comments and are ignored by R (I put these in to help explain the commands). I'm getting behind on producing these scripts, but you will find a lot more in my notes above.

- Simple Poisson probability calculations.
- Simple binomial probability calculations.
- A simple likelihood function.
- Fisher's tea tasting experiment (Fisher's exact test).
- Death penalty data (Cochran-Mantel-Haenszel test).
- Snoring and heart disease (logistic regression for Exercise 4.2).
- Exercise 4.11 (Poisson loglinear model with horseshoe crab data) .
- More snoring and heart disease (logistic regression for Exercise 5.3).
- Gender and party affiliation (logistic regression for Exercise 5.6).
- Exercise 5.13 Adolescent sex (logistic regression). Demonstrates two similar ways of handling the data too.
- Exercise 6.3 Loglinear models for the death penalty data.
- Exercise 8.3 Baseline-category logits for afterlife example.

Here are some copies of the functions and data file defined in my notes for R and CDA above. Note that all of these are either going into the R package for the class (available soon), or they are included in the newest version of R.

- The R package for the course. This version seems to be working, but there's not a lot in it yet. I will be continuing to update it.
- procfreq
- ftable: this is included in the new release of R. In case you are still running version 0.90 you can just save this file and use the "source()" function to load it into R whenever you need to use it.
- chismoke.dat: the Chinese smoking and lung cancer data (Agresti, Table 3.3).
- crabs.dat: the crabs data. Note that the crab weights are in grams, whereas in the text they are in kilograms. Also the color codes are slightly different.

Brett Presnell <presnell@stat.ufl.edu> Last modified: Mon Apr 17 21:31:41 EDT 2000