[R] the secret (?) language of lists
Berton Gunter
gunter.berton at gene.com
Wed Nov 15 00:43:47 CET 2006
Peter Dalgaard wrote:
There are a few basic principles in play here, once you know them, the
rest follows; I'm not sure exactly where they are documented, but I'd
guess at Venables & Ripley's books (MASS, S Programming) at least, the
"Blue Book" on S, and possibly others.
The first suggestion requires that you know or now about the following
- matrices are vectors with dim attibutes, stored column-major
** This is clearly documented in AN Introduction to R
binding rows into matrices with rbind()
** Documented in rbind's Help file.
- c() removes attributes
** Documented in c()'s Help file
The second one requires
- rep function, and its each=
** Documented in rep's Help file
- vector recycling in arithmetic
** Documented in Introduction to R and many Help files
So, in fact, one does not need to go so far as MASS or S Programming -- or
heaven forfend! -- the Blue Book. Indeed I learned about all of this by just
reading the basic stuff before I even knew about these other (excellent and
valuable, I grant) resources. Of course, cleverness in using R's
well-documented capabilities is never guaranteed, but it is important to
recognize that one need not hunt for the docs: they're where they should be.
Which, I regret to say, leads me to echo Brian Ripley's pungent plea:
install.packages("fortunes"); library(fortunes); fortune("WTFM")
Cheers,
Bert Gunter
> I am reminded of quote by Byron Ellis: "Contrary to popular belief
> the speed of R's interpreter is rarely the limiting factor to R's
> speed. People treating R like C is typically the limiting factor. You
> have vector operations, USE THEM." Not exactly the point, but close.
>
> Thanks!
>
> Jeff Spies
> http://www.nd.edu/~jspies/
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
______________________________________________
R-help at stat.math.ethz.ch 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.
More information about the R-help
mailing list