The Weirdest (and Coolest) Thing about R
I just read an online interview with Bob Muenchen, author of R for SAS and SPSS Users. He nicely describes an important aspect of R that I found to be one of the weirdest and most difficult to grasp, but once I “got it,” fell in love. Quoting at length:
In other analytics software, the focus is on variables. It sounds too simple to even bother saying: “Every procedure accepts variables.” There are very few ways to specify them, such as by simple name, A, B, C, or lists like A TO Z or A—Z.
Rather than just variables, R has a variety of objects such as vectors, factors and matrices. Some procedures (called functions in R) require particular kinds of objects and there are many more ways to specify which objects to use. From a new user’s perspective that may seem like needless complexity. However it provides significant benefits. Once an R user has defined a categorical variable as a factor, analyses will then try to “do the right thing” with that variable. For instance, you could include it in a regression equation and R would create the indicator variables needed to handle a categorical variable automatically.
Taking this example even further: Then you can put your whole regression model into a new object (call it Model1). Then try another model and put that into an object called Model2. Then you can run the ANOVA function on these two objects, and voilà, R tells you which is the better model. In fact, just about everything you do in R can become an object, and then be submitted to further statistical procedures that adjust to the type of object it is.
In our upcoming newsletter, we show another example: Create a function that calculates the rectangular area defined by any point on a curve. Put that function into object. Then run the optimize function on that object, and voilà, R tells you the point on the curve that results in the optimal area as well as the area defined by that point.
I found R frustratingly difficult to learn at first. But once I got the hang of it, it turned into this weirdly intuitive tool. I would fumble around, make guesses, and try logical things that made conceptual sense. Sure enough, my efforts would succeed.
R is free, so give it a try! For us it required a substantial investment of time and learning, but that paid off in terms of our enhanced capabilities and efficiencies. Feel free to give us a call (312-348-6089) if you want to chat more about our experiences with R or with the other two statistical packages we use most often.