[R] two questions for R beginners
Karl Ove Hufthammer
karl at huftis.org
Mon Mar 1 11:02:59 CET 2010
On Thu, 25 Feb 2010 17:31:19 +0000 Patrick Burns
<pburns at pburns.seanet.com> wrote:
> * What were your biggest misconceptions or
> stumbling blocks to getting up and running
> with R?
I didn't have any major stumbling blocks, but even after years of using
R I didn't have a clear concept of what exactly a vector, a list and a
data frame was, and what was the difference and similarities between
them (and stuff like why does x[i] return a different result than
Some things that have tripped my up is reassigning the value of T or F
and getting very strange results afterwards (I now use only TRUE and
FALSE). FAQ 7.31 and 7.22 have also been troublesome at times,
especially 7.31 when used in 'for' loops.
Also I found it quite confusing that
works, but not
(you have to type ?"if")
Also, why ?plot didn't give me the information I was looking for but
?plot.default did was rather confusing. I still experience similar
problems with other functions. Usually 'methods' help, but some packages
use S4 methods, which makes finding the correct help package quite
challenging at times.
> * What documents helped you the most in this
> initial phase?
In the initial phase I found the Rtips
For understanding the difference between the various data types in R,
Phil Spector's wonderful book 'Data Manipulation with R' was a great
help. When reading it I finally understood things I have been wondering
about for years. It really like the book. It's short, crystal clear and
Another very useful document of a more advanced nature is the R Inferno.
Best read after you've been using R for some time, though.
I'm over the initial phase now, but two resources which continue to be
of great help is http://www.rseek.org/ (mainly for searching the mailing
list) and the 'sos' package (for finding the functions and packages I
need). 'sos' really is great. There have been other packages/functions
trying to do the same thing, but they have been to time-consuming and
difficult to use (and learn), typically requiring you to first do a
search, and then do some advanced subsetting to get useful results. This
is similar to older search engines requiring many boolean terms to give
the needed search results. With 'sos' I just choose some simple search
terms describing what I'm looking for, and immediately get relevant
results. 'sos' really is the Google of the R world. It has made a great
impact on the discoverability of the various R functions and packages.
Lastly, the 'demo' function is seldom mentioned, and easy to overlook,
but gives a nice (and sometimes impressive) overview of what type of
graphics is possible to create with a given packages. I wish more
packages would have well-written demos. Also, I think some of the
examples from the 'example' sections of help pages for functions could
very well be copied to the demo of the corresponding package, e.g. a few
of the examples of the 'xyplot' function in 'lattice'.
Karl Ove Hufthammer
More information about the R-help