[R] the secret (?) language of lists
Jeffrey Robert Spies
jspies at nd.edu
Wed Nov 15 01:15:57 CET 2006
Thanks for the responses; and Gunter, I apologize if you feel you
"WTFM" again in responding.
The two issues that I originally had in understanding why the
operations behaved as they did were in (1) c() reducing an rbind the
way it did, and (2) vector recycling, as Peter mentioned. Issue (1)
I'm hard pressed to find in any documentation that this is the way c
would behave in this situation and would appreciate a pointer if it
does exist in the "basic stuff". Issue (2) is in deed in the intro;
I was unfamiliar with the term recycling.
I've been following the list for a while and these seem like things
that those of us less familiar with vector-based programming, even
having "RTFM", might not immediately think of when it comes time to
implementing them. Although, (as you mentioned, Gunter) R is very
well documented overall, this is where some of Peter's references
might be ideal.
Thanks again,
Jeff.
On Nov 14, 2006, at 6:43 PM, Berton Gunter wrote:
> 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