[R] Learning the R way – A Wish

Patrick Burns pburns at pburns.seanet.com
Wed Mar 6 20:31:49 CET 2013


On 06/03/2013 07:20, Andrew Hoerner wrote:
> Dear Patrick--
> After the official Core Team's R manuals and the individual function
> help pages, I have found "The R Inferno" to be the single most useful
> piece of documentation when I have gotten stuck with a R problems. It is
> the only introduction that seems to be aware of the ambiguities present
> in the official documentation and of some of the ways one can get stuck
> in traps of misunderstanding. Plus, it is enjoyably witty.
>
> When I first started using it, I found it ranged from very useful to
> pretty frustrating. I did not always understand what the examples you
> presented were trying to say. It is still true that I occasionally wish
> for a little more discursive explanatory style, but as time goes by I

Actually I find myself sometimes thinking the same thing.

Pat


> find that I am increasingly likely to get the point just from the example.
>
> Many thanks, Andrew
>
>
> On Tue, Mar 5, 2013 at 1:46 AM, Patrick Burns <pburns at pburns.seanet.com
> <mailto:pburns at pburns.seanet.com>> wrote:
>
>     Andrew,
>
>     That sounds like a sensible document you propose.
>     Perhaps I'll do a few blog posts along that vein -- thanks.
>
>     I presume you know of 'The R Inferno', which does
>     a little of what you want.
>
>     Pat
>
>
>
>     On 04/03/2013 23:42, andrewH wrote:
>
>         There is something that I wish I had that I think would help me
>         a lot to be a
>         better R programmer, that I think would probably help many
>         others as well.
>         I put the wish out there in the hopes that someone might think
>         it was worth
>         doing at some point.
>
>         I wish I had the code of some substantial, widely used package –
>         lm, say –
>         heavily annotated and explained at roughly the level of R
>         knowledge of
>         someone who has completed an intro statistics course using R and
>         picked up
>         some R along the way.  The idea is that you would say what the
>         various
>         blocks of code are doing, why the authors chose to do it this
>         way rather
>         than some other way, point out coding techniques that save time
>         or memory or
>         prevent errors relative to alternatives, and generally, to
>         explain what it
>         does and point out and explain as many of the smarter features
>         as possible.
>         Ideally, this would include a description at least at the
>         conceptual level
>         if not at the code level of the major C functions that the
>         package calls, so
>         that you understand at least what is happening at that level, if
>         not the
>         nitty-gritty details of coding.
>
>         I imagine this as a piece of annotated code, but maybe it could
>         be a video
>         of someone, or some couple of people, scrolling through the code
>         and talking
>         about it. Or maybe something more like a wiki page, with various
>         people
>         contributing explanations for different lines, sections, and
>         practices.
>
>         I am learning R on my own from books and the internet, and I
>         think I would
>         learn a lot from a chatty line-by-line description of some
>         substantial block
>         of code by someone who really knows what he or she is doing –
>         perhaps with a
>         little feedback from some people who are new about where they
>         get lost in
>         the description.
>
>         There are a couple of particular things that I personally would
>         hope to get
>         out of this.  First, there are lots of instances of good coding
>         practice
>         that I think most people pick up from other programmers or by having
>         individual bits of code explained to them that are pretty hard
>         to get from
>         books and help files.  I think this might be a good way to get
>         at them.
>
>         Second, there are a whole bunch of functions in R that I call
>         meta-programming functions – don’t know if they have a more
>         proper name.
>         These are things that are intended primarily to act on R
>         language objects or
>         to control how R objects are evaluated. They include functions
>         like call,
>         match.call, parse and deparse, deparen, get, envir, substitute,
>         eval, etc.
>         Although I have read the individual documentation for many of
>         these command,
>         and even used most of them, I don’t think I have any fluency
>         with them, or
>         understand well how and when to code with them.  I think reading a
>         good-sized hunk of code that uses these functions to do a lot of
>         things that
>         packages often need to do in the best-practice or standard R
>         way, together
>         with comments that describe and explain them would help a lot
>         with that.
>         (There is a good smaller-scale example of this in Friedrich Leisch’s
>         tutorial on creating R packages).
>
>         These are things I think I probably share with many others. I
>         actually have
>         an ulterior motive for suggesting lm in particular that is more
>         peculiar to
>         me, though not unique I am sure. I would like to understand how
>         formulas
>         work well enough to use them in my own functions. I do not think
>         there is
>         any way to get that from the help documentation. I have been
>         working on a
>         piece of code that I suspect is reinventing, but in an awkward
>         and kludgey
>         way, a piece of the functionality of formulas. So far as I have
>         been able to
>         gather, the only place they are really explained in detail is in
>         chapters 2
>         & 3 of the White Book, “Statistical Models in S”. Unfortunately,
>         I do not
>         have ready access to a major research library and I have way,
>         way outspent
>         my book budget. Someday I’ll probably buy a copy, but for the
>         time being, I
>         am stuck without it. So it would be great to have a piece of
>         code that uses
>         them explained in detail.
>
>         Warmest regards to all,  andrewH
>
>
>
>
>         --
>         View this message in context:
>         http://r.789695.n4.nabble.com/__Learning-the-R-way-A-Wish-__tp4660287.html
>         <http://r.789695.n4.nabble.com/Learning-the-R-way-A-Wish-tp4660287.html>
>         Sent from the R help mailing list archive at Nabble.com.
>
>         ________________________________________________
>         R-help at r-project.org <mailto:R-help at r-project.org> mailing list
>         https://stat.ethz.ch/mailman/__listinfo/r-help
>         <https://stat.ethz.ch/mailman/listinfo/r-help>
>         PLEASE do read the posting guide
>         http://www.R-project.org/__posting-guide.html
>         <http://www.R-project.org/posting-guide.html>
>         and provide commented, minimal, self-contained, reproducible code.
>
>
>     --
>     Patrick Burns
>     pburns at pburns.seanet.com <mailto:pburns at pburns.seanet.com>
>     twitter: @burnsstat @portfolioprobe
>     http://www.portfolioprobe.com/__blog
>     <http://www.portfolioprobe.com/blog>
>     http://www.burns-stat.com
>     (home of:
>       'Impatient R'
>       'The R Inferno'
>       'Tao Te Programming')
>
>
>
>
> --
> J. Andrew Hoerner
> Director, Sustainable Economics Program
> Redefining Progress
> (510) 507-4820

-- 
Patrick Burns
pburns at pburns.seanet.com
twitter: @burnsstat @portfolioprobe
http://www.portfolioprobe.com/blog
http://www.burns-stat.com
(home of:
  'Impatient R'
  'The R Inferno'
  'Tao Te Programming')



More information about the R-help mailing list