Live data from Hacker News

The R language, for programmers

johndcook.com

21–30 of 79 posts

Re: The R language, for programmers

#21

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.table package: almost any manipulation can be done by reference.

Re: The R language, for programmers

#22
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?

Not sure how complex your use case is, but I've found Pandas (on Python) to be just as powerful and much more performant than R for working with scientific data. It's built on Numpy so you can use Scipy's statistical functions with it seamlessly.

Re: The R language, for programmers

#23

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…

PyCharm is worth a look but I agree with the terminal+ipython resort, a place I often find myself too. RStudio was great and then I tried the server version and it suddenly became bloody amazing as I was able to keep R close to the data and have a completely remote IDE.

Re: The R language, for programmers

#25
post #20

I find R to be a great language for exploring a data set and doing some prototyping. There are a lot of wonderful statistical tools available through the core packages and even more through the various community extensions. It does have some significant issues that I've found limit the usefulness outside of prototyping - pass by value only means code tends to end up as monolithic functions - very slow in loops so lot…

> pass by value only means code tends to end up as monolithic functions I've actually found R works very well as a functional language with very lean functions. It's perhaps worth noting that R doesn't copy a dataframe in a function call if you don't modify it, which is a very common use-case for me. (I'm not sure if this extends to other datatypes) > very slow in loops so lot contorting to move things to matrix oper…

Python has better and better support for R with Rpy2 and R like data frames with Pandas, which is helping me take advantage of the incredibly useful analysis libraries in R.

Also note that loops are slow enough that it is really worth learning the *apply() functions in R to avoid iterating over collections. For a relatively in depth explanation check out Hadley Wickham's book http://adv-r.had.co.nz/Functionals.html

Re: The R language, for programmers

#27

I'd like to see a detailed explanation of R's scoping. It's not just lexical scoping; callees can deliberately manipulate the scope their arguments are evaluated in, for example. So you can call a function and pass arguments that are available in local scope, but the arguments are lazily evaluated, and the callee might evaluate them in an entirely different scope. Typically this is done for manipulating datasets. You…

You can think of the lazily evaluated arguments feature a lot like lisp macros. Basically, any function in R can either get the value of its arguments (i.e. acting like a regular function) or it can get the unevaluated expression passed for that argument (i.e. acting like a lisp macro). So in your "do.stuff" example, it's not a matter of special scoping, per se. The do.stuff function is actually getting the symbols "…

That would be a FEXPR in Lisp, not a macro. In most actually used Lisp dialects, FEXPRs have been replaced with macros.

Re: The R language, for programmers

#28

I find R to be a great language for exploring a data set and doing some prototyping. There are a lot of wonderful statistical tools available through the core packages and even more through the various community extensions. It does have some significant issues that I've found limit the usefulness outside of prototyping - pass by value only means code tends to end up as monolithic functions - very slow in loops so lot…

Java still has arrays limited to 2^31-few and no-one cares. And matrix operations make your code closer to the actual math, so less error-prone.

Re: The R language, for programmers

#29
post #20

Earlier quoted context omitted.

> pass by value only means code tends to end up as monolithic functions I've actually found R works very well as a functional language with very lean functions. It's perhaps worth noting that R doesn't copy a dataframe in a function call if you don't modify it, which is a very common use-case for me. (I'm not sure if this extends to other datatypes) > very slow in loops so lot contorting to move things to matrix oper…

Python has better and better support for R with Rpy2 and R like data frames with Pandas, which is helping me take advantage of the incredibly useful analysis libraries in R. Also note that loops are slow enough that it is really worth learning the *apply() functions in R to avoid iterating over collections. For a relatively in depth explanation check out Hadley Wickham's book http://adv-r.had.co.nz/Functionals.html

*apply functions are loops underneath -- they only look better and save you time possibly wasted on growing some dynamically sized output structure. The way of solving slow loop in R is to find package which implements it in C/Fortran (or write your own in case there is none).
Post reply on HN