Best Book To Learn R Programming

Questions on how we spend our money and our time - consumer goods and services, home and vehicle, leisure and recreational activities
Post Reply
User avatar
Topic Author
gatorman
Posts: 2493
Joined: Wed Oct 31, 2007 9:35 am
Location: The Swamp

Best Book To Learn R Programming

Post by gatorman »

I'm learning to program in R. Any ideas as to the best book to use to learn the language? I'm currently working through "learn R In a Day" which is a nice introductory book, but obviously won't get me to a high level of proficiency. Many years ago I was pretty good at programming in Fortran (I think I used Fortran IV), I could also write assembly language programs for the 8088 chip. But it's been more than 25 years since I've done any programming, so I'm a "little" rusty. Any thoughts would be appreciated.
gatorman
User avatar
market timer
Posts: 6535
Joined: Tue Aug 21, 2007 1:42 am

Re: Best Book To Learn R Programming

Post by market timer »

Have you looked at Coursera? Johns Hopkins offers a course in R, along with a data science specialization track that is based on R.
target2030
Posts: 70
Joined: Sun May 04, 2014 11:55 am

Re: Best Book To Learn R Programming

Post by target2030 »

The Johns Hopkins courses in R offered on Coursera (free) are great.
User avatar
Topic Author
gatorman
Posts: 2493
Joined: Wed Oct 31, 2007 9:35 am
Location: The Swamp

Re: Best Book To Learn R Programming

Post by gatorman »

market timer wrote:Have you looked at Coursera? Johns Hopkins offers a course in R, along with a data science specialization track that is based on R.
Thanks for that suggestion! I didn't know that anything like that was even available.
gatorman
G-Force
Posts: 349
Joined: Sun Sep 20, 2009 3:03 pm
Location: Florida

Re: Best Book To Learn R Programming

Post by G-Force »

I like a Beginner's Guide to R by Zuur, but if you already have Learn R in a Day, this will likely be redundant. There are a few R courses on lynda.com that may help.

Since you already have a basic book on R, your next step might be a book that's more focused on a particular area of study that you wish to pursue. Zuur also has several books on mixed-effects modeling, for example.
Naismith
Posts: 530
Joined: Sun Sep 14, 2014 2:58 pm

Re: Best Book To Learn R Programming

Post by Naismith »

market timer wrote:Have you looked at Coursera? Johns Hopkins offers a course in R, along with a data science specialization track that is based on R.
+1 very helpful in getting started
KlangFool
Posts: 31526
Joined: Sat Oct 11, 2008 12:35 pm

Re: Best Book To Learn R Programming

Post by KlangFool »

market timer wrote:Have you looked at Coursera? Johns Hopkins offers a course in R, along with a data science specialization track that is based on R.
+10

I am taking that class. It is very good...

KlangFool
30% VWENX | 16% VFWAX/VTIAX | 14.5% VTSAX | 19.5% VBTLX | 10% VSIAX/VTMSX/VSMAX | 10% VSIGX| 30% Wellington 50% 3-funds 20% Mini-Larry
Deep Thoughts
Posts: 102
Joined: Tue May 13, 2014 1:27 pm

Re: Best Book To Learn R Programming

Post by Deep Thoughts »

Just for curiosity, why are you interested in R? It's mainly for statisticians isn't it? I like it since it's free. I personally find Matlab (or the free version Octave) much easier and more powerful for the analyses (stochastic algorithms and system analysis) that I need to do.
dailybagel
Posts: 553
Joined: Tue Feb 15, 2011 7:35 pm

Re: Best Book To Learn R Programming

Post by dailybagel »

I have used R in the past. Honestly, my impression is that it's too complicated, with too many special cases and implicit conventions (eg apply, lapply, sapply).

If I were in your shoes, I would look at Python and the 'pandas' package before diving fully into R. It provides much of the power of R, but in a more mainstream language.
User avatar
VictoriaF
Posts: 20122
Joined: Tue Feb 27, 2007 6:27 am
Location: Black Swan Lake

Re: Best Book To Learn R Programming

Post by VictoriaF »

dailybagel wrote:I have used R in the past. Honestly, my impression is that it's too complicated, with too many special cases and implicit conventions (eg apply, lapply, sapply).

If I were in your shoes, I would look at Python and the 'pandas' package before diving fully into R. It provides much of the power of R, but in a more mainstream language.
We don't know anything yet about gatorman's shoes and reasons for learning R. I am planning to learn it, too, and for me it's important that R is an open-source, widely-used language. A simpler package could be easier to learn but more difficult to maintain.

Victoria
Inventor of the Bogleheads Secret Handshake | Winner of the 2015 Boglehead Contest. | Every joke has a bit of a joke. ... The rest is the truth. (Marat F)
User avatar
stevewolfe
Posts: 1676
Joined: Fri Oct 10, 2008 7:07 pm

Re: Best Book To Learn R Programming

Post by stevewolfe »

target2030 wrote:The Johns Hopkins courses in R offered on Coursera (free) are great.
I've taken this class (completed 100% with distinction), it's very good and called "Computing for Data Analysis". The assignments are realistic and quite interesting. Highly recommended and now part of a certification track for data scientist!
richard
Posts: 7961
Joined: Tue Feb 20, 2007 2:38 pm
Contact:

Re: Best Book To Learn R Programming

Post by richard »

VictoriaF wrote:
dailybagel wrote:I have used R in the past. Honestly, my impression is that it's too complicated, with too many special cases and implicit conventions (eg apply, lapply, sapply).

If I were in your shoes, I would look at Python and the 'pandas' package before diving fully into R. It provides much of the power of R, but in a more mainstream language.
We don't know anything yet about gatorman's shoes and reasons for learning R. I am planning to learn it, too, and for me it's important that R is an open-source, widely-used language. A simpler package could be easier to learn but more difficult to maintain.

Victoria
Python is open-source and very widely used, much more widely used than R. It's also a general purpose language, with many widely available libraries for specialized uses.

Whether R is better for your and gatorman's purposes is another question.
User avatar
VictoriaF
Posts: 20122
Joined: Tue Feb 27, 2007 6:27 am
Location: Black Swan Lake

Re: Best Book To Learn R Programming

Post by VictoriaF »

richard wrote:
VictoriaF wrote:
dailybagel wrote:I have used R in the past. Honestly, my impression is that it's too complicated, with too many special cases and implicit conventions (eg apply, lapply, sapply).

If I were in your shoes, I would look at Python and the 'pandas' package before diving fully into R. It provides much of the power of R, but in a more mainstream language.
We don't know anything yet about gatorman's shoes and reasons for learning R. I am planning to learn it, too, and for me it's important that R is an open-source, widely-used language. A simpler package could be easier to learn but more difficult to maintain.

Victoria
Python is open-source and very widely used, much more widely used than R. It's also a general purpose language, with many widely available libraries for specialized uses.

Whether R is better for your and gatorman's purposes is another question.
I agree with you about Python itself. But dailybagel proposed a package of Python and Panda as a replacement for R, and I don't know how it is used in comparison with R. I admit ignorance in this matter and look forward to dailybagel's clarification.

Victoria
Inventor of the Bogleheads Secret Handshake | Winner of the 2015 Boglehead Contest. | Every joke has a bit of a joke. ... The rest is the truth. (Marat F)
richard
Posts: 7961
Joined: Tue Feb 20, 2007 2:38 pm
Contact:

Re: Best Book To Learn R Programming

Post by richard »

VictoriaF wrote:<>I agree with you about Python itself. But dailybagel proposed a package of Python and Panda as a replacement for R, and I don't know how it is used in comparison with R. I admit ignorance in this matter and look forward to dailybagel's clarification.

Victoria
I don't know either. It might be worth browsing:

http://pandas.pydata.org/ The description includes that it enables "you to carry out your entire data analysis workflow in Python without having to switch to a more domain specific language like R."

https://www.google.com/search?q=python+pandas
ourbrooks
Posts: 1575
Joined: Fri Nov 13, 2009 3:56 pm

Re: Best Book To Learn R Programming

Post by ourbrooks »

R, like S on which is based, is a scripting language for statistical analysis. The idea is that the language contains a library of statistical analyses and that you use R to combine them together to do custom analyses. R is like the SAS JMP scripting language.

Part of learning R is learning statistical analysis. If you don't understand, say, eigenvector analysis, then R may be difficult to learn. Maybe what the OP needs first is a good book on multivariate analysis.

R occupies a kind of middle ground. If you can't do the kind of factor analysis you want in an Excel plug-in, the next level is use a statistical package, which doesn't require any programming. If you have lots of complicated logic for cleaning up the data, estimating missing values, etc. or you want to use your own custom version of factor analysis, then R would be a good choice.

If what you want to do is get some data out of comma separated text files, put it in a relational database, statistically analyze it, and then display it in an interactive graphical display on a web page, then most of your code won't be statistical analysis and you really need a general purpose programming language, such as Java or python.

If what you want to do is learn programming, then I agree with all of the other posters who suggest more mainstream programming languages. Their syntax tends be more regular and there are a lot more books and videos out about them. There are also core computer science concepts which are programming language independent; if you understand how a depth first tree walk algorithm works, then you shouldn't have any problem understanding the python or Java or Fortran versions.
User avatar
3CT_Paddler
Posts: 3485
Joined: Wed Feb 04, 2009 4:28 pm
Location: Marietta, GA

Re: Best Book To Learn R Programming

Post by 3CT_Paddler »

I like the Python approach using Pandas, but R may be more useful if there are existing R libraries (of which there are thousands) that the OP wants to use. Getting Pandas and all of its dependencies properly installed has become progressively more difficult/tedious with each new version.
User avatar
Topic Author
gatorman
Posts: 2493
Joined: Wed Oct 31, 2007 9:35 am
Location: The Swamp

Re: Best Book To Learn R Programming

Post by gatorman »

Thanks for all the replies. R is the language I want to learn at this time, and I have good reasons which I don't want to go into on this forum. I appreciate the discussion of other languages, and I may pick some of them up down the road, but my current emphasis is on learning R.

Victoria (and anyone else interested in R), I've identified a lot of resources for learning R. If you would like some links, I can probably save you a good bit of time. PM me if you are interested.

I've worked through a good bit of the Learn R in a Day book and find it helpful. It is available as a download on the Kindle at a nominal cost. I'd recommend it.

Thanks again,
gatorman
jstat
Posts: 200
Joined: Mon Jan 19, 2009 1:53 pm

Re: Best Book To Learn R Programming

Post by jstat »

"The R Inferno" gives some good insights into R traps and pitfalls. http://www.burns-stat.com/documents/boo ... r-inferno/
User avatar
Topic Author
gatorman
Posts: 2493
Joined: Wed Oct 31, 2007 9:35 am
Location: The Swamp

Re: Best Book To Learn R Programming

Post by gatorman »

jstat wrote:"The R Inferno" gives some good insights into R traps and pitfalls. http://www.burns-stat.com/documents/boo ... r-inferno/
Thanks! Great book, I read the first couple chapters and saved a copy to read the rest later.
gatorman
HurdyGurdy
Posts: 1177
Joined: Wed May 09, 2012 10:21 pm

Re: Best Book To Learn R Programming

Post by HurdyGurdy »

I've learned a lot from the old _The New S Language_ book, and from _Introduction to Scientific Programming and Simulation Using R_ by Owen, Maillardet and Robinson. Matloff's _The Art of R Programming: A Tour of Statistical Software Design_ is very well regarded.

If you remember a bit of Lisp or APL, you' ll find it familiar. Loops a la Fortran can become very inefficient in R -- -vector processing is preferred. It is possible to run Fortran code within R -- _The New S Language_ has a section on it. It is easy if you have a Linux-like system.

Every area has their own packages, please check http://cran.r-project.org/web/views/ for what interests you. But since there are new libraries all the time, even the previous page cannot cover the very cutting edge. Some Linux distributions like Debian may not have the very latest R-base and packages available.
User avatar
3CT_Paddler
Posts: 3485
Joined: Wed Feb 04, 2009 4:28 pm
Location: Marietta, GA

Re: Best Book To Learn R Programming

Post by 3CT_Paddler »

You could also take a look at The Art of R Programming... I am not an R user, but it pops up on my recommended book reading list on Amazon all the time and has very good reviews.
User avatar
Tycoon
Posts: 1630
Joined: Wed Mar 28, 2012 7:06 pm

Re: Best Book To Learn R Programming

Post by Tycoon »

Emotionless, prognostication free investing. Ignoring the noise and economists since 1979. Getting rich off of "smart people's" behavioral mistakes.
richard
Posts: 7961
Joined: Tue Feb 20, 2007 2:38 pm
Contact:

Re: Best Book To Learn R Programming

Post by richard »

User avatar
Topic Author
gatorman
Posts: 2493
Joined: Wed Oct 31, 2007 9:35 am
Location: The Swamp

Re: Best Book To Learn R Programming

Post by gatorman »

richard wrote:Portfolio Analysis in R
http://www.capitalspectator.com/portfol ... portfolio/
Great post! Thank you!
gatorman
richard
Posts: 7961
Joined: Tue Feb 20, 2007 2:38 pm
Contact:

Re: Best Book To Learn R Programming

Post by richard »

Reading that post is inspiring me to start watching the coursera videos. The libraries available for R look interesting.

I'd still recommend learning python first, absent a special reason, for most people.
User avatar
Topic Author
gatorman
Posts: 2493
Joined: Wed Oct 31, 2007 9:35 am
Location: The Swamp

Re: Best Book To Learn R Programming

Post by gatorman »

richard wrote:Reading that post is inspiring me to start watching the coursera videos. The libraries available for R look interesting.

I'd still recommend learning python first, absent a special reason, for most people.
I'd recommend the Learn R in a Day as a quick way to get into it. There's also another book, R in a Nutshell that's available as a free pdf download. I'm reading it now and think it is pretty good. Finally, the recommended course book for the Coursera course (500 pgs +/-) is also available as a free download if you look around a little. Here are some other links I found to be helpful:

http://cran.r-project.org/doc/manuals/r ... intro.html
http://www.bioconductor.org/
http://cran.r-project.org/web/packages/ ... _name.html
http://cran.r-project.org/doc/contrib/Short-refcard.pdf
http://www.e-reading.link/bookreader.ph ... with_R.pdf
http://www.statmethods.net/
https://r-forge.r-project.org/
http://www.omegahat.org/

Hope that helps. R is not hard to understand, but there doesn't seem to be any consistency in naming conventions, and the documentation I've reviewed isn't that great, which slows down the learning process some. All that said, still very doable.

I think I will take the Coursera courses as well.
gatorman
mlipps
Posts: 1099
Joined: Thu Jun 21, 2012 9:35 am

Re: Best Book To Learn R Programming

Post by mlipps »

3CT_Paddler wrote:You could also take a look at The Art of R Programming... I am not an R user, but it pops up on my recommended book reading list on Amazon all the time and has very good reviews.
I have this one and its a bit brief. I also own R for Everyone, I would recommend it much more highly. FWIW, I'm a student in a data science program so I've been learning R quite extensively, so I have used both books a lot.

I have The Art of R Programming on my Kindle and I think I got it on super sale (probably less than $5) during a back to school sale. I would regret the purchase if had cost more.
dotstar
Posts: 42
Joined: Sun Dec 01, 2013 8:07 am
Location: Somewhere near the middle

Re: Best Book To Learn R Programming

Post by dotstar »

I agree about the Coursera courses ... very enjoyable, not terrible difficult, yet enough of a challenge to be satisfying.

I am currently working through "R in Action" which has been valuable, but may not be the best to introduce you to R.

Another couple interesting websites:
http://rseek.org/
http://simplystatistics.org/
http://www.r-bloggers.com/
User avatar
Topic Author
gatorman
Posts: 2493
Joined: Wed Oct 31, 2007 9:35 am
Location: The Swamp

Re: Best Book To Learn R Programming

Post by gatorman »

richard wrote:Portfolio Analysis in R
http://www.capitalspectator.com/portfol ... portfolio/
More info on the quantmod package here:

http://www.quantmod.com/examples/intro/

but the documentation on CRAN is a lot better.

I also found this to be helpful:

http://statmath.wu.ac.at/~hornik/QFS1/q ... gnette.pdf


gatorman
James2
Posts: 123
Joined: Fri Mar 29, 2013 7:40 pm
Location: Minnesota

Re: Best Book To Learn R Programming

Post by James2 »

Thanks for posting the links Gatorman. Back in the day, I learnt R with Robert Gentleman and Ross Ihaka as part of my degree. They were the original developers of R. Brings back a lot of memories, perhaps I'll have to dig into the books you posted :sharebeer
User avatar
Topic Author
gatorman
Posts: 2493
Joined: Wed Oct 31, 2007 9:35 am
Location: The Swamp

Re: Best Book To Learn R Programming

Post by gatorman »

James2 wrote:Thanks for posting the links Gatorman. Back in the day, I learnt R with Robert Gentleman and Ross Ihaka as part of my degree. They were the original developers of R. Brings back a lot of memories, perhaps I'll have to dig into the books you posted :sharebeer
You are certainly welcome. It must have been pretty cool to have learned a language from the original developers.
gatorman
User avatar
Topic Author
gatorman
Posts: 2493
Joined: Wed Oct 31, 2007 9:35 am
Location: The Swamp

Re: Best Book To Learn R Programming

Post by gatorman »

Here is a link to a pdf on Monte Carlo methods in R:

http://www.stat.ufl.edu/archived/casell ... C-UseR.pdf

gatorman
Last edited by gatorman on Tue Jan 27, 2015 10:26 am, edited 1 time in total.
User avatar
Topic Author
gatorman
Posts: 2493
Joined: Wed Oct 31, 2007 9:35 am
Location: The Swamp

Re: Best Book To Learn R Programming

Post by gatorman »

This is probably the last link I'll post on this thread. I thought this tutorial on working with time series data was too good to pass up:

http://faculty.washington.edu/ezivot/ec ... in%20R.pdf

gatorman
Post Reply