Hi,
Bert Gunter wrote:
speedup over explicit loops. As you said, their greatest advantage is
elegance and code readability (as functional programming, rather than
procedural programming, constructs).
As you also said, vectorizing calculations is a central theme in R that
takes some getting used to. I know of no general prescriptions for how to do
it; I, too, am still learning.
I think it takes time and experience.
To get you started, the following items might be helpful:
If I recall correctly, John Chambers dedicated some part of his book
"Programming with Data" on "the whole object view". (Again, if I
remember and interpret it correctly) he means that one should not think
element-by-element wise but thinking about "the whole object" you want
to manipulate.
Please note that he authored another book, published within the last few
weeks called "Software for Data Analysis: Programming with R". Maybe
there is also something on the subject.
"S Programming" by William Venables & Brian D. Ripley also provides very
helpful information on the topic.
Please search also on the web for "S Poetry" by Patrick Burns. It is
available for free and very informative.
Best,
Roland
______________________________________________
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.