Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I had a plan of learning R in the near future. Reading another question I found out about Clojure. Now I don't know what to do.

I think a big advantage of R for me is that some people in Economics use it, including one of my supervisors (though the other said: stay away from R!). One advantage of Clojure is that it is Lisp-based, and as I have started learning Emacs and I am keen on writing my own customisations, it would be helpful (yeah, I know Clojure and Elisp are different dialects of Lisp, but they are both Lisp and thus similar I would imagine).

I can't ask which one is better, because I know this is very personal, but could someone give me the advantages (or advantages) of Clojure x R, especially in practical terms? For example, which one should be easier to learn, which one is more flexible or more powerful, which one has more libraries, more support, more users, etc?

My intended use: The bulk of my estimation should be done using Matlab, so I am not looking for anything too deep in terms of statistical analysis, but rather a software to substitute Excel for the initial data manipulation and visualisation, summary statistics and charting, but also some basic statistical analysis or the initial attempts at my estimation.

share|improve this question
7  
If you would taste R, it is highly probable that you will resign from MATLAB (as in my case). –  mbq Jul 19 '10 at 21:33
    
IMO, this should be community wiki (language "versus" type questions are pretty subjective). –  Shane Jul 19 '10 at 21:34
    
This is definitely a question concerning programming languages and should be asked on Stack Overflow. –  Sharpie Jul 19 '10 at 21:35
    
I agree with Sharpie. @Vivi: you should change the question title to be "advantages and disadvantages for data munging" or something along that line so that it's more on-topic. –  Shane Jul 19 '10 at 21:37
5  
@Sharpie, @Shane IMO to this extent it is a question about tools, so it is acceptable. –  mbq Jul 19 '10 at 21:54

3 Answers 3

up vote 23 down vote accepted

Let me start by saying that I love both languages: you can't go wrong with either, and they are certainly better than something like C++ or Java for doing data analysis.

For basic data analysis I would suggest R (especially with plyr). IMO, R is a little easier to learn than Clojure, although this isn't completely obvious since Clojure is based on Lisp and there are numerous fantastic Lisp resources available (such as SICP). There are less keywords in Clojure, but the libraries are much more difficult to install and work with. Also, keep in mind that R (or S) is largely derived from Scheme, so you would benefit from Lisp knowledge when using it.

In general:

The main advantage of R is the community on CRAN (over 2461 packages and counting). Nothing will compare with this in the near future, not even a commercial application like matlab.

Clojure has the big advantage of running on the JVM which means that it can use any Java based library immediately.

I would add that I gave a talk relating Clojure/Incanter to R a while ago, so you may find it of interest. In my experience around creating this, Clojure was generally slower than R for simple operations.

share|improve this answer

I have been a heavy R user for the past 6-7 years. As a language, it has several design limitations. Yet, for work in econometrics and in data analysis, I still wholeheartedly recommend it. It has a large number of packages that would be relevant to you for econometrics, time series, consumer choice modeling etc. and of course excellent visualization, good algebra and numerical libraries etc. I would not worry too much about data size limitations. Although R was not designed for "big data" (unlike, say, SAS) there are ways around it. The availability of packages is what makes the difference, really.

I've only read Clojure's language specs, and it's beautiful and clean. It addresses in a natural way issues of parallelization and scale. And if you have some basic java or OOP knowledge, you can benefit from the large number of high-quality java libraries.

The issue I have with Clojure is that is a recent one-man (R.Hickey) operation, therefore 1) very risky 2) very immature 3) with niche adoption. Great for enthusiasts, early adopters, CS/ML people who want to try new things. For a user who sees a language as a means to an end and who needs very robust code that can be shared code with others, established languages seem a safer choice. Just know who you are.

share|improve this answer
    
Thanks for your answer, it makes sense :) –  Vivi Jul 25 '10 at 19:29
    
+1 Great answer. I had a similar debate a while back because I was intrigued by Incanter (and have done some Java coding). It was clear that R was the language to use to get statistical work done quickly while Clojure was the language to use to think more like a computer scientist. Obviously there is overlap but as you say "know who you are". –  Josh Hemann Oct 21 '11 at 13:13
    
SAS is so old that it originally ran on punched cards, hence its awkward and archaic syntax. Some amount of its "big data design" is simply dumb luck that it was originally designed to run on "mainframes" that had less memory than your phone, and which used punched cards to input data. I wouldn't say it's "designed" for Big Data, even though it happens to handle it well. –  Wayne Feb 8 at 19:26
    
I had similar concerns about Clojure in 2011 when I first heard of it. I don't now, in 2014. Clojure and its community are fairly mature, and it's surprisingly popular (after all, it's a non-OO, functional, Lisp). However, I don't believe Incanter will ever catch up to R in number of packages (usually, if you can think of it, it's already been done). There's a Clojure library Rincanter based on the JRI Java-R interface, but I'm not sure how easy this is to use. –  Mars Feb 8 at 19:34

Here's a data point: R has a "big data ceiling", useful to know if you plan on working with huge data sets.

I'm unsure whether the same limitations apply to Clojure/Incanter, whether it outperforms R or is actually worse. I imagine the JVM can probably handle large datasets, especially if you manage to harness the power of Clojure's lazy features.

share|improve this answer
1  
R is also lazy evaluated. –  mbq Jul 20 '10 at 9:04
    
@mbq good to know, thanks! –  Mike Mazur Jul 20 '10 at 10:48
2  
@mbq: Your comment is misleasing. R lazily evaluates variables in a function definition but "laziness" is not normal behavior. The function delayedAssign() exists to tell the interpreter to be lazy with a variable's assignment, but the interpreter will make the evaluation once any data structure points to that variable, whether it needs to be evaluated or not. Further, the commercial R company Revolution Analytics had to create an iterator object to support their marketing for using R in "big data" analysis. –  Josh Hemann Oct 21 '11 at 17:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.