[R] Book: The New S Language

From: Chris.H. Snow <chs23_at_student.open.ac.uk>
Date: Wed, 12 Dec 2007 06:45:54 GMT

I'm struggling a bit with R with understanding functions and what's going on under the hood.

For example, I was given this snippet of code via this mailing list:

DF <- data.frame(A =c("A", "A", "A", "B", "C"), B=c(1,1,2,2,0)) g <- paste(DF$A, DF$B)
s <- split(DF, g)

split appears to be taken the string provided by paste, e.g. "A 1", and then deciding that the first character "A" in this string relates to DF$A, and the second character "1" to DF$B.

The split help pages don't really tell me why split is working like this - maybe I'm just looking in the wrong place in the help page.

I've got plenty of books on R, but only one of them gives a bit of info on the use of split - not in enough detail though. Does the book referenced in the help pages ("The New S Language") give more insight into this and other functions?

Will I just get an Aha! moment with R after using it for a while?

Thanks in advance...


R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 12 Dec 2007 - 06:51:25 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 12 Dec 2007 - 08:30:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.