Live data from Hacker News

The R language, for programmers

johndcook.com

71–79 of 79 posts

Re: The R language, for programmers

#71
post #60
post #58

I've been looking at a variety of R packages, mostly for the purposes of rewriting them in C++ for greater speed, and my assessment is that most of them are of very low code quality. I don't mean that they don't work (they usually do), or that they are too slow (they usually are, but this is explained by selection bias given the reasons I'm looking at them), but that there is little standardization even with a given…

I'll admit that as someone who has a package on CRAN, has been using R since ~2001 and who is a normal software developer in their day to day job that the lack of standardization is something I'm guilty of. For me what happened was that my thoughts on appropriate naming, structure, etc has evolved over the 6 (I think?) years of the package's existence but I simply haven't had the time to make the wholesale changes ne…

Thanks for the kind words :)

Re: The R language, for programmers

#72

The biggest "gotcha" for learning R as a programmer is that R interprets character vectors of data frames as factor vectors by default , which will usually break something in your code. If you're learning R, learn to use dplyr for data manipulation and ggplot2 for plotting. Both will save you a lot of time.

> If you're learning R, learn to use dplyr for data manipulation I had been learning data.table, but I really like dplyr's % operator and the compositional functions better. I think I'm going to make the move to dplyr.

FWIW The performance difference is insignificant unless your working with >>10 of millions of rows.

Re: The R language, for programmers

#73
post #66

To me writing tutorials for teaching R these days is same as writing tutorials for Fortran (and I'm sure Fortran still has some nice goodies not available elsewhere). It misdirecting people eager to learn something to a wrong thing. As you can see in this article, every 3rd section of R book or tutorial is often dedicated in gotachas to deal with. We have iPython, Notebook, sci-kitlearn, numpy etc and massive number…

In the Python portfolio I'd mention matplotlib.

Then Sage (sagemath.org) just dazzles me. It's a grand integrated environment using Python with lots of math/stat software built in (including NumPy and R) and lots more optional (including Matlab). You can just go see it and try it at cloud.sagemath.com. If you like it you can continue to use it there or you can download it - it's free open-source software.

Re: The R language, for programmers

#74

The biggest "gotcha" for learning R as a programmer is that R interprets character vectors of data frames as factor vectors by default , which will usually break something in your code. If you're learning R, learn to use dplyr for data manipulation and ggplot2 for plotting. Both will save you a lot of time.

> If you're learning R, learn to use dplyr for data manipulation I had been learning data.table, but I really like dplyr's % operator and the compositional functions better. I think I'm going to make the move to dplyr.

We're in the process of adding more detailed vignettes illustrating more clearly the philosophy behind data.table's `i, j, by`. Should make things lot easier for beginners - https://github.com/Rdatatable/data.table/issues/944

data.table is not just fast, but is also more memory efficient - we want to highlight in the vignettes as well.

And timings are quite relevant even on 10 million rows: https://gist.github.com/arunsrinivasan/db6e1ce05227f120a2c9

For much larger data, check the project page: https://github.com/Rdatatable/data.table/wiki/Benchmarks-%3A...

Re: The R language, for programmers

#75
post #19

I'm curious for others thoughts on what to use for complex statistics if you needed high performance/speed. Running an R script on a server to process data isn't efficient, but does that mean you have to roll your own stats package if you want to have a Java (for example) back-end?

Here's a benchmark Matt recently did comparing data.table, dplyr and pandas on 50GB and 100GB: https://github.com/Rdatatable/data.table/wiki/Benchmarks-%3A...

Re: The R language, for programmers

#76
post #72

Earlier quoted context omitted.

> If you're learning R, learn to use dplyr for data manipulation I had been learning data.table, but I really like dplyr's % operator and the compositional functions better. I think I'm going to make the move to dplyr.

FWIW The performance difference is insignificant unless your working with >>10 of millions of rows.

I thought dplyr (note, not plyr, dplyr is the next iteration of plyr implemented mostly in native code) was pretty much as fast as data.table.

Re: The R language, for programmers

#77
post #48
post #44

Earlier quoted context omitted.

If I just want to learn Statistical Programming, is R good for that? I can't afford/not willing to buy SAS or Matlab.

Yes, it is. The language itself is free and the runtime environment can be downloaded for free. There's even a good IDE for it called R Studio, which has a good free version. R is based on S, which itself was purely designed as a statistical programming language.

How tough would it be to learn R, then get hired at someplace that uses SAS or Matlab or something, and try to learn that? It sounds like R isn't used quite as much as other options

Re: The R language, for programmers

#78

I love pandas much more than R but GOD I love Rstudio. Such a great IDE. Rstudio server, actually. My equivalent is running ipython notebook on an ec2 instance, which....is fine, but is a lot of scrolling.

As an every-day R user but only-occasional python user, everytime I do a python project I spend some time looking for a comparable IDE. Closest i found was Spyder, but random lock ups made it unusable. Back to terminal+ipython and sublime. Sublime REPL + ipython doesn't cut it either. What do you love about pandas, is it performance, syntax, access to other python modules? If performance, take a look at R's data.tabl…

Now if we can only get sublime text 2 within an ipython notebook on the cloud.....

For me, R was my first language, and then I learned Python, and beautiful things like list comprehensions, and it just clicks with my brain a bit more.

In pandas, a group by operation is beautiful

dataset2=dataset1.groupby([stuff], as_index=False).mean()

Same with pivot table...

When I did this with dplyr2 my work flow would be a few more steps, creating the "summarise" object and so forth and so on, which seems like more steps.

Re: The R language, for programmers

#79
post #47

Earlier quoted context omitted.

I've heard all good things about ggplot2 and I sincerely believe they're true. However, my only experience has been trying to plot 2 overlapping timeseries that didn't have the same length to the same plot area. I found that to be nearly impossible in ggplot2 and almost trivial with the builtin plot and lines commands in R. Like a lot of good tools, it seems that ggplot2 makes the common case extremely easy, but it c…

> s1 > s2 > s > qplot(x, y, data=s, geom=c('point', 'line'), color=series)

Thanks. I guess this speaks more to my lack of lack of experience.
Post reply on HN