Live data from Hacker News

One Year with R

github.com

221–230 of 266 posts

Re: One Year with R

#221
post #195

I've recently started getting into computational archaeology and found the entire ecosystem is built around R, meaning I am now starting to learn about it. Anyone have a suggestion of the standard books/courses one should start with? I found it pretty interesting that the alternative to R is Haskell for general CLI tools! Seeing some open issues in a popular tool for dealing with ancient DNA (aDNA) about making inval…

Any chance of sharing which tool(s)? I know some people who're involved in making the haskell ecosystem a better place for less mainstream users and I'm pretty sure they'd want to know more about this.

(and if it turns out they already know, -I- don't, and that sounds pretty cool and fun to read up on :)

Re: One Year with R

#222
post #188

I am surprised no one has mentioned the awful [garbage collector]( https://stackoverflow.com/q/14580233/850781 ). The R garbage collector is imperfect in the following (not so) subtle way: it does not move objects (i.e., it does not compact memory) because of the way it interacts with C libraries. (Some other languages/implementations suffer from this too, but others, despite also having to interact with C, manage to…

Honestly, probably because so many languages have non-compacting collectors that people just accept it as a trade-off - in the sense that compacting collectors are non-trivial and without lots of work can produce significantly higher GC pauses, and so doing it really well requires a lot of engineering effort that you might prefer to be spent elsewhere adding features you want more.

golang's collector isn't compacting either - though it uses per-size-class arenas for allocation so you don't end up with fragmentation bloat to nearly the same extent. Part of me wonders if simply building R against jemalloc would get a decent chunk of the same advantages.

Re: One Year with R

#223

Earlier quoted context omitted.

I had some Matlab experience about 3 decades ago. What's you take in Matlab vs R as programming languages?

My take is that Matlab is better in basically every regard, with the exception that the same functionality will cost you a considerable amount of real world money. Having used both in a professional setting - and coming in with a fair bit of programming experience - Matlab is generally a pleasure to use. It's different where it needs to be in order to treat matrices as first class citizens, but otherwise you can appl…

But isn’t the consensus that R is a better language? At least that is what the cool kids said when I went to college (I never used Matlab except maybe a handful of times.)

Re: One Year with R

#224
post #70

I think this is really interesting. The author certainly isn't an expert, for example `result[which(result But that's just why it's useful - R is great when you are an expert, but becoming an expert takes years. The perspective of new users is really important. (I've been using R almost 20 years, have written several packages, and still feel like an amateur. Indeed, I'd never heard of `**` as an alias for `^` until t…

> Maybe Julia is the way forward? Julia is well worth learning, if you do computationally-expensive work. It is kind of a pain to use interactively, though. I use both R and Julia in my research. Think of Julia as the new Fortran, though, not the new R.

Isn’t Julia a compiled language “pretending” to be interpreted? I thought it was interpreted or JITd up until it’s last release or so when they mentioned it has to actually compile. It’s fast, sure, but is it faster than other compiled languages?

Re: One Year with R

#225
post #195

I've recently started getting into computational archaeology and found the entire ecosystem is built around R, meaning I am now starting to learn about it. Anyone have a suggestion of the standard books/courses one should start with? I found it pretty interesting that the alternative to R is Haskell for general CLI tools! Seeing some open issues in a popular tool for dealing with ancient DNA (aDNA) about making inval…

We used the books Hadley Wickham has published for R courses in my stats program [1].

I supplemented the theory parts of my other courses with some of these [2] R books about using the methods instead of deriving and proving properties about them.

There are also some R studio cheat sheets [3].

[1] https://hadley.nz/

[2] https://www.routledge.com/Chapman--HallCRC-The-R-Series/book...

[3] https://www.rstudio.com/resources/cheatsheets/

Re: One Year with R

#226

Earlier quoted context omitted.

R "just works" now because a huge amount of effort has gone into improving the language over the last 10 or so years, in part spurred by the tidyverse movement, although not restricted in scope to tidyverse. When I was starting grad school around 2010, if someone sent you some R code, the chances that you would be able to "just run" it were basically zero: there would be weird version mismatches in how functions work…

I dunno man, python has always seemed a little bit worse on this stuff to me. At least with R if you had a consistent version, everything off CRAN worked together. I think R 3.0 introduced namespaces which fixed a lot of the really crazy stuff. Also, I was writing Sweave in 2010 for my thesis, and I definitely wasn't alone.

Namespaces showed up around 2004, so somewhere around 2.0.0. I don't think they were mandatory until much later.

Re: One Year with R

#227
post #221
post #195

I've recently started getting into computational archaeology and found the entire ecosystem is built around R, meaning I am now starting to learn about it. Anyone have a suggestion of the standard books/courses one should start with? I found it pretty interesting that the alternative to R is Haskell for general CLI tools! Seeing some open issues in a popular tool for dealing with ancient DNA (aDNA) about making inval…

Any chance of sharing which tool(s)? I know some people who're involved in making the haskell ecosystem a better place for less mainstream users and I'm pretty sure they'd want to know more about this. (and if it turns out they already know, -I- don't, and that sounds pretty cool and fun to read up on :)

Sure! It’s the department of archaeogenetics at the Max Planck Institute for Evolutionary Anthropology

https://poseidon-framework.github.io/#/

Re: One Year with R

#228
post #212
post #128

Earlier quoted context omitted.

This is just a quick example - I would be grateful if people could recreate this brief look at UK COVID figures in another language: library(tidyverse) library(scales) download.file(url = "https://api.coronavirus.data.gov.uk/v2/data?areaType=overview&metric=covidOccupiedMVBeds&metric=newAdmissions&metric=newCasesBySpecimenDate&metric=newDeaths28DaysByDeathDate&metric=newPeopleReceivingFirstDose&format=csv", destfile…

This was fun to play around with. I made some very minor changes and posted at https://gist.github.com/hadley/d54895557fbb0fe0402d2277b9011... . It revealed to me that there's a buglet in `forcats::last()` ( https://github.com/tidyverse/forcats/issues/303 ) and made me wonder if `pivot_longer()` should be able to rename the columns as you pivot them ( https://github.com/tidyverse/tidyr/issues/1338 )

This might be the most excited I've gotten about a comment in hackernews for a while! So interesting to see your style of code (I was actually on 4.0 so gave me the impetus to upgrade to get the new pipes). fct_reorder - what a hugely useful function I didn't know about. The chicks vignette was nicely illustrative. And label_date_short also super useful. Also curious generally about your bracket style (I just tend to pile them all up when closing, which is something I only do in R and probably shouldn't!).

Renaming factors is one of those things that always seems a bit awkward. I think I've used several methods. Passing a list of named vectors into `levels(x)` allows a many-to-one mapping but was quite dangerous. I've used revalue and mapvalues from plyr. fct_recode is new to me. But yes, renaming while reshaping could be quite convenient. Just looking at fct_recode now, it looks really nice. Seems to support many-to-one and being able to pass it a name vector is very convenient.

Learnt so much today, and this is even before trying out the python and julia examples! Many thanks for this and all your work in R!

Re: One Year with R

#229
post #61

R, and by R I mean R+tidyverse, is the world's best graphing calculator attached to an OK scheme. To which I mean R is a highly optimized, well-oiled machine if you're using it for its highly-optimized, well-oiled purposes. I tend to have notebooks full of tiny fragments like this dat_min %>% group_by(ymd = make_date(year(date), month(date), day(date))) %>% summarize(vol_btc=sum(vol_btc), vol_usdt=sum(vol_usdt), trad…

> R is a highly optimized, well-oiled machine if you're using it for its highly-optimized, well-oiled purposes. This hits home for me. We are just starting to use R for risk modeling where I work. R, more than any language I've ever used, makes me appreciate "worse is better". From a theoretical "aesthetic" perspective R is a mess. Yet for data processing all those theoretical concerns don't matter. It just works. It…

Is there any reason you chose R over Python? Is it just because that’s the go to language?

Re: One Year with R

#230
post #201

Earlier quoted context omitted.

I hadn't thought about R as a "worse is better" language, but that's a good way to think about it. Makes sense, too, since it came from the place that inspired worse is better.

R comes from New Zealand, no?

I’m trying to figure out if you were actually asking a question or if it was rhetorical and you were calling shots.
Post reply on HN