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

______________________________________________
R-help@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.

Reply via email to