Live data from Hacker News

R, the master troll of statistical languages (2012)

talyarkoni.org

151–154 of 154 posts

Re: R, the master troll of statistical languages (2012)

#151
post #127

Earlier quoted context omitted.

The lack of data structures in R is a totally fixable problem.

Sure, through packages, but you'd need to adapt the entire standard library to take advantage of them, so you could pass new data structures to built-in functions and get meaningful results. Generic iterators would also be extremely useful to build in, so it's easy to work with a wide variety of structures.

And generic functions allow you to fill in those missing pieces from a package too.

Re: R, the master troll of statistical languages (2012)

#152
post #147

Earlier quoted context omitted.

You must not do a lot of regression with categorical data, then. I use commands like `lm(y ~ (x1 + x2) * factor_variable, data = d)` and `xyplot(y ~ x1 | factor_1, groups = factor_2, data = d)` all the time.

Those also work just fine with strings.

Via an implicit call to factor, right?

Re: R, the master troll of statistical languages (2012)

#153
post #142

Earlier quoted context omitted.

some things require more understanding and experience, for no obvious benefit...in which case they're anti-patterns, or not best practice in language design. there are a lot of things in R that are good but it's an old language and there's a lot of cruft. like "R has three object oriented systems (plus the base types), so it can be a bit intimidating." http://adv-r.had.co.nz/OO-essentials.html and believe it or not,…

If you want to go over data-frame in parallel just replace call to lapply() with mclapply(). I agree about 3 OO systems, but let's not mix things up here. Casual user (who doesn't know sapply) doesn't interact with that.

hmmh, here's the problem I was trying to solve.

data frame has 2 columns, 20 years of portfolio returns, and 20 years of % withdrawn.

using a starting portfolio value, calculate the 20 ending portfolio values for each year and the dollar amount withdrawn.

worked ok looping through the data frame, but was unreasonably slow.

never figured out how to use a vectorized method that could go through the frame building each new element from the one previously calculated.

maybe I missed something obvious?

(the parallel part came in because I was doing it on a lot of portfolios, so to speed it up just launched the same slow function on several lists of them in parallel. writing that one function above in C probably would have been OK. I think I got it to work but then I couldn't get the right version of compiler to work with the right version of R which supported the other libraries I was using. was a few years ago so maybe things weren't as stable. I never said I was very good :)

Re: R, the master troll of statistical languages (2012)

#154
post #39

Earlier quoted context omitted.

R is, I think, an interesting language because it's heavily used by people who would not otherwise learn a programming language. If you compare R not with other programming languages, but with other ways of working with statistical data, this makes far more sense. I don't actually "know" SAS in the way I know a programming language - I know the commands I invoke to do what I want it to do. Similarly, I encounter lots…

Also, many people use it only intermittently, maybe once every six months or so when they have some data to look at. Rather than try to relearn the language and its quirks yet again, it's much easier to take what you did last time and tweak it until you get what you need.

This too. Between collecting data, writing grant proposals, writing papers, etc. I don't spend time day-in, day-out using R.

Often the first hour of that is thinking "Shit, how do I do that again? Has Hadley written a package to do this better by now? What did I do last time - why did I do that last time?"

Post reply on HN