Notes on R statistics and programming language

Tuesday, January 21, 2003

Good introduction to R http://hesweb1.med.virginia.edu/biostat/s/Design.html

Friday, January 17, 2003

Learned two things about R today:

1. How to subset a dataframe.
Either use the subset function, or use vector-subsetting notation. The latter means x[(condition),] and the output datafame will include all rows (hence the comma) where condition holds. subset() is obvious and documented.

2. How to extract from a list. The lapply and sapply functions extract apply functions to the elements of a list. For example sapply(Lst,function(x)x[1]) will extract the first item from each vector in list Lst.

This page is powered by Blogger. Isn't yours?