Cal Poly Pomona

R Resources

R is a very full featured, complex, and difficult to learn statistics package. The good news is that it is free to anyone who wants it. The bad news is the difficulty involved in learning R. Help is included with the R program, but even the help is difficult for a beginner. You may download R from The R Project for Statistical Computing web site.

Here are some links to sites / items / books I have found helpful.

Course Materials

As part of my process of learning R, I try to recreate analyses from my various courses. Below are the scripts and data files for R that do the course examples. I will be happy to try to help you if you encounter problems. I would really appreciate being informed of any errors you find.

All of the files below are in text format, and all are quite small (less than 12 KB).

Materials are available for:

Biometrics (BIO 211)

All of the statistical tests done in BIO 211 are in one file, which has a little over 200 lines. The tests are "blocked" in the file, so it is easy to copy the code for one test.

Data are included within the scripts. These are the examples from the BIO 211 Test Pac. Your R output should match the Test Pac pretty closely. Read the scripts for any exceptions. Notes: the "Wilcoxon Signed Rank Test" is the same as the "Wilcoxon Paired-Sample Test."

The file is available with both an ".R" extension, and an ".txt" extension in case you encounter difficulties downloading. The two files are both text files and are identical, only the file extension is different.

bio211_Biometrics_scripts.R The ".R" version

bio211_Biometrics_scripts.txt The ".txt" version

For Advanced Biometrics Students:



ANOVA (BIO 575 - Biological Applications of ANOVA)

I have recreated most of the examples found in the ANOVA Pac, at least to the best of my current ability. In a few cases, the R output does not match the output from SAS found in the ANOVA Pac. This may be due to my lack of knowledge, and/or due to the fact that the folks who write R don't always agree with the folks who write SAS on how some things should be done.

You may download all the files in a zip file ( It's less than 20 KB.

Data Files
one_factor_ANOVA_using aov_TukeyHSD.R baby_data_R.txt
two_factor_ANOVA_TestPac_aov.R guinea_pig_rnd_blk.txt
mixed_model_sugar.R sugar_mixed_model_ANOVAPac.txt
unbalanced_plants.R unbalanced_plant_example.txt
(Begin second half of class) (Begin second half of class)
latin_square_car_example.R latin_square_cars.txt
nested_one_level.R nested_drug_source.txt
nested_two_level.R nested_drug_source_lot.txt
nested_crossed_leaf_aspect.R leaf_aspect.txt
repeated_measures_smoking_device.R repeated_measures_smoking_device.txt
repeated_measures_swimmers.R repeated_measures_swimmers.txt
repeated_measures_plants_CO2.R repeated_measures_plants_CO2.txt
split_plot_farm.R split_plot_legume_grain_data.txt
manova_baby_weight_PO2.R manova_baby_weight_PO2.txt


Advanced Biometrics (BIO 575 Advanced Biometrics)

I have attempted to recreate the AdPac output, but in some cases the R output does not match the output from SAS found in the ANOVA Pac. This may be due to my lack of knowledge, and/or due to SAS and R doing things differently.

You may download all the files in a zip file ( It's less than 20 KB.

Scripts Data Files
advbiom_multiple_regression.R AdvBiom_Pollute.txt
advbiom_ridge_regression.R AdvBiom_Pollute.txt
advbiom_polynomial_regression.R AdvBiom_distance_moisture.txt
advbiom_logistic_regression.R AdvBiom_logistic_physician.txt
advbiom_PCA.R (Turtle PCA) AdvBiom_turtle_data.txt
advbiom_PCA_pollute.R (Pollution data PCA) AdvBiom_Pollute.txt
advbiom_discriminant_analysis.R AdvBiom_Pollute.txt
advbiom_canonical_correlation.R (bird example)  
advbiom_canonical_correlation_pollute.R AdvBiom_Pollute.txt
advbiom_multivariate_multiple_regression.R AdvBiom_Pollute.txt
advbiom_cluster_analysis_pollute.R AdvBiom_Pollute.txt



The first thing to do is go to the R web site: Manuals section. You will find a link to the Manuals section in the panel on the left titled Documentation. Click Manuals, then download the pdf file titled: An Introduction to R. You will want to look through this, and read sections that seem important to you. Don't try to read and understand everything. Use this as a reference as you go along.

Here are some web sites I recommend:

Quick-R This site is relatively simple and straight-forward. I have found it quite helpful.

UCLA ATS R site This is the UCLA Academic Technology Resources site on R. Many of the examples are pretty simple and fairly straight forward. Lots of stuff here.

Local tips for R This is a site at the Department of Experimental Psychology, Cambridge University, UK. Nice, clear presentation of examples.

Gardener's Own - Using R for statistical analyses Site of Dr. Mark Gardener, an ecologist in the UK. Nice examples.

Princeton University Library Actually a collection of links and some documents. A helpful place to find some resources.

Kickstarting R Be a bit careful with this one. This is actually located at the R web site, and tends to be difficult. It is also biased towards people who use a UNIX-based operating system.

Of course, you can always search for something. For example, if you Google: ANOVA R, you get over 14 million hits. Some sites may be helpful, but many will be rather specific and complex. Note: you can cut it down to ~23,000 hits if your search is "ANOVA R". :-)


There are lots of books about R; just search Amazon! Two that you might look at are:

R In a Nutshell by Joseph Adler. The first edition was published in 2010. A second edition is due in August 2012.

The R Book by Michael Crawley. Expensive but more complete than the Adler book. Published in 2007. A second edition is due, but as of this writing (May 2012), there is no announced date.