[R] Book: The New S Language
Chris.H. Snow
chs23 at student.open.ac.uk
Wed Dec 12 07:45:54 CET 2007
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...
Chris
More information about the R-help
mailing list