Vijay's blog

Monthly Archives: December 2014

I love using array (vector) languages. Amongst them J (http://www.jsoftware.com) and R (http://www.r-project.org/) are my two most preferred languages. Why? Because, they enable exploratory, interactive programming. This is such an under appreciated feature that I also became aware of it, only, very recently.

As a part of overseeing graduate students’ work (as a part of my job) I get asked questions about student’s theses research. In our discussion it will, more often than not, happen that the student will say “Let me show you how I did it” and will want to show me how they went about doing whatever it is that they tried to do. I observe what they are doing and I start getting questions in my head. If the student has thought about my questions they’ll be able to answer them promptly, but if they haven’t thought of it we’re stuck! I ask my questions. Either I let the student try to figure it out and provide a reasonable answer or get ready to do some very rough/quick exploratory analysis. Whenever this situation occurs I always remember my graduate school years. When I was a graduate student I didn’t know R (only a little Python…most definitely not J) or any other exploratory/interactive language and I would spend hours to find basic information which now takes me a couple of minutes. Let me try to explain with an example.

I will assume that you have access to a computer (sorry a tablet/iphone/android just won’t do for now) on which you have installed R and the package data.table (http://cran.r-project.org/web/packages/data.table/index.html) installed. Also, you have 1033-program-foia-may-2014.csv stored in a directory somewhere and your R session’s current working directory (inquired by getwd() in an R session) workspace is currently that directory. Below is the session of my usage of R to get this information from the csv file. $ represents shell prompt and > represents R prompt.