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 Sent from the R help mailing list archive at Nabble.com.
On Mar 4, 2013, at 3:42 PM, 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.Not sure that you have a valid idea of the cost of that particular investment... at bookfinder.com Bookseller Notes Price 1. United States Softcover, ISBN 0412053012 Publisher: Chapman & Hall/CRC, 1991 Section: Computer Languages: The Attic $21.94 Chapter 2 was useful for some of the the purposes you propose, but chapter 3 did not. However, I would suggest that you might instead purchase "S Programming" by Venables and Ripley. And ... it was even cheaper at Bookfinder. Reviewing the indices shows of both texts shows a far greater treatment of the functions you list above. I found the later, more up-to-date text "Software for Data Analysis" to be less helpful in understanding the R/S "internals" than the "S Programming" text. It was surprisingly sparse with its coding examples. You could sometimes go for pages without seeing any code. Extended discussions of how the R/S approach differed from Java or C were not helpful to me. It would, however, be essential if you were headed toward S4 methods which seems to be it's main goal. And of course this is just one reader's (and a not particularly expert reader) experience. -- David Winsemius Alameda, CA, USA
The book that helped me break into R and more advanced texts was Crawley's "Statistics: An Introduction with R." Very light read that assumes no prior knowledge with stats or R. I am using it to teach my fellow grad students R and all agree it was worth scrimping pennies to get. He also has a series of exercises (for free) that may be close to what you need. http://www3.imperial.ac.uk/naturalsciences/research/statisticsusingr Andrew On 03/04/2013 05:42 PM, 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 > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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.
Hi Andrew: Not that I've gone through it all yet but the draft of hadley's book at https://github.com/hadley/devtools/wiki/Introduction has a lot if not all of the commands you refer to and all of their gory details along with many examples. No matter what you're budget, given that the book will be finished in dec, 2013, I would print out the current draft ( it changes frequently so your draft will become not current pretty quickly ) and make a binding ( actually I had to make two bindings out of it ) and go through it slowly. I was doing that for a while and it was quite enlightening until I got sidetracked with other things. On Mon, Mar 4, 2013 at 6:42 PM, andrewH <ahoerner@rprogress.org> 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 > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >[[alternative HTML version deleted]]
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 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@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@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@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 [[alternative HTML version deleted]]