Site icon R-bloggers

First thoughts on R

[This article was first published on Adventures in Statistical Computing, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Having worked just a little with R, I have some first impressions to share.  I’ll give you some links to resources I found helpful with writing the previous project.

First, the documentation is not very good.  I struggled on previous attempts to figure things out.  I still find it crap shoot when I Google, looking for an answer.  Luckily I found a book with a good primer on things.

Second, really, foo.bar is an acceptable variable name?!?  For the longest time I thought I was missing something looking at examples until I realized that “bar” was not a property on an object “foo.”  foo.bar is just a variable/object name and if you have another object named “foo” the two are not related.  Still makes my head hurt.

2.5 — I can access properties on an object with $.  Seems like an odd choice.

6 Data frames are neat.  This took me longer to understand because of #2 than it should have.  To me, it really looks like a hash object containing arrays of equal length.  It helped to to think of them as plain “object” types from Actionscript — accessing columns in multiple ways like DF$column, or DF[,”column”] is very similar to obj.property or obj[“property”] is AS.

5  I still don’t understand the mechanics behind the scenes though.  Why when I accessed properties in the Time Series object did I have to use obj[,”property”] instead of obj$property? When I look at the structure (str() function — I like) the types are different.  Something is going on, but I don’t know what.

5.1 How does scoping work with variables in functions? If I don’t delete variables inside the function, do they get garbage collected?

6  Many ways to do things.  The two packages I used relied on 2 different types of time series collections.  That threw me for a loop.  Luckily I got it to work.  In one iteration of code I was casting things back and forth using the as.<type>() functions.

7 head() and str() functions are great.  Wish I knew about them when I started.  I saw them in some examples about half way though the project.

8 R needs better default output and publishing tools.  I can easily get information overload from SAS and have it in nicely formatted HTML, PDF, RTF, XML, Excel, etc.  I would love to see an equivalent in R.

Well, I ranted enough on that.

Here is the honor roll of helpful resources:

  1. Option Pricing and Estimation of Financial Models with R  Stefano M Iacus.  I actually ready this cover to cover on my plane trip last week.  The appendix was the most helpful tool I had for the project.
  2. Time Series Analysis with R -Part I, Walter Zucchini, Oleg Nenadi´c.  I need to reread this free PDF.  I skimmed it and it’s examples helped me learn how charting works.
  3. Producing Simple Graphs with R Frank McCown.  Another helpful site for graphics.
  4. Quick-R.  Excepts from the book R in Action.  I plan on buying this in the near future.
  5. I also have The R Book by Michael J. Crawley.  The sheer size of this is daunting, but I am hoping that it will become a go to resource (and maybe answer some of my questions).  It didn’t make the trip with me because of it’s size.

To leave a comment for the author, please follow the link and comment on their blog: Adventures in Statistical Computing.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.