[Rd] Working on a Vignette called Rcheology

Paul Johnson pauljohn32 at gmail.com
Tue Jun 12 22:14:38 CEST 2012


Greetings, R developers

Here are my requests today.

1. Would you care to review this vignette
http://pj.freefaculty.org/R/Rchaeology.pdf and tell me if you think it
is wrong headed, and

2. Supposing  you do not think I'm completely wrong, would you care to
point me at more examples of R idioms that lead to deep insights into
the nature of R programming?


Longer more boring explanation:

In the rockchalk package, I have functions to make it easier to teach
regression to students who aren't R programmers. I just uploaded
package version 1.6 to CRAN. While I do this, I'm reading R source
code all the time because I need to understand how functions like
summary and anova receive R objects, take them apart, and do specific
chores.  I've been very glad that R is open source while I do this.

While working on this, an inspiration hit me! I want to call
"Rchaeology" the study of R idioms and customs deduced from the R
source code written by the experts.  Practicing this makes me an
Rchaeologist.

I've started a vignette, it's in rockchalk and up here:

http://pj.freefaculty.org/R/Rchaeology.pdf

I plan to work out sections that explore some particular usage
examples that touch on things that expose special features of the R
language.  Right now, I've only got one worked out, it explores this
idiom that Gabor  G. explained to me, which receives a formula object
and replaces a variable "x1" with "x1c".

do.call("substitute", list(newFmla, setNames(list(as.name("x1c")), "x1")))

I think that one is fabulous, It sheds a lot of light when you break
it down to pieces.

I'd like to build up a good list of "Do This, Not That" bits, but it
is hard to find particular approaches that almost all of you will
agree to.  Almost everybody agrees that calling rbind over and over
again is slow, and do.call with rbind and a collection of stackable
things is better:

http://pj.freefaculty.org/R/WorkingExamples/stackListItems.R

If you have ideas for "Do This, Not That", I'd be glad to hear them
and I'll look for example applications that make them relevant.

pj

-- 
Paul E. Johnson
Professor, Political Science    Assoc. Director
1541 Lilac Lane, Room 504     Center for Research Methods
University of Kansas               University of Kansas
http://pj.freefaculty.org            http://quant.ku.edu



More information about the R-devel mailing list