Live data from Hacker News

One Year with R

github.com

191–200 of 266 posts

Re: One Year with R

#191
post #185

Earlier quoted context omitted.

> R feels like a language that was built for people who were using excel, I don't think so. Most people who come to R after years of Excel find it just as alien as you do.

I recall when the pipe operator was first being proposed the argument for it was that it'd enable workflows that felt more like Excel. The implication being that indeed, base R is alien to an Excel user. I also recall my pushback was along the lines of "who on earth would want that". Yeah, it's a good thing I'm not the person coming up with these things :)

How do you feel about the pipe operator these days?

Re: One Year with R

#192
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…

I think these kind of common task challenges are great for comparison. You see a few approaches to a single task and you can do a more aligned and detailed comparison. Unfortunately, it’s also a lot of work. In this case, you’ve posted an intermediate stage artifact from R. If one of the many Python programmers reading this want to produce a comparable artifact they need to understand or run that code. That alone red…

Good point, looks like I'm too late to edit, but here's a link [1] (excuse the R style indexing).

Yes, I love these things and very curious to see what hackernews comes up with. Project Euler was an eye opener for how things could be optimised in different languages.

[1] https://i.imgur.com/M8DX98I.png

Re: One Year with R

#193

Earlier quoted context omitted.

The packages that were used in statistics were SAS, SPSS and Stata. perl is not a statistical package and has nowhere near the depth of statistical capabilities of R. Don't forget that I also mentioned the checkpoint package in my post. You only need to know the date for that, not the version of each of the packages. In your last paragraph I think you are referring more to software development practices than what is…

That's a very roundabout way to solve an actual problem. In many cases you don't pin your package version to _latest_ (whatever that date is) and you need a more fine-grained solution to keeping package versions. I don't think that solves this and I don't know if you can do it with checkpoint.

Of course it is possible to screw up but if you don't update your packages and record the date that does not seem to be R's fault.

Re: One Year with R

#194
post #185

Earlier quoted context omitted.

I recall when the pipe operator was first being proposed the argument for it was that it'd enable workflows that felt more like Excel. The implication being that indeed, base R is alien to an Excel user. I also recall my pushback was along the lines of "who on earth would want that". Yeah, it's a good thing I'm not the person coming up with these things :)

How do you feel about the pipe operator these days?

I haven't used R enough in the last 10 years to have an R-specific opinion. And to be honest it was more an unlearned statement on my part as it was an "ew, Excel" response and not thinking about the underlying workflow.

In the intervening time I've become a large advocate for the pattern of chained operators. So I'd imagine I'd enjoy piping in R. And if that means I'm emulating a common Excel workflow, that's fine. I won't have the childish response of "ew, Excel" :)

Re: One Year with R

#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 invalid states impossible within the type system made me genuinely laugh out loud in amazement. I didn't expect that level of technical knowledge within the world of archaeology.

Re: One Year with R

#196
post #47
post #23

The common trope with R is that statisticians and love it and developers hate it. The the main reason that statisticians love it is that the libraries useful to them are much better in R than elsewhere (though Python keeps encroaching in that turf, and "real developers" dislike Python a lot less than they do R). The main reasons that developers hate it is that it is very unlike almost all other languages that they're…

> it doesn't help that almost nobody learned R as their first computer (as opposed to statistics) language. Aside from two statisticians I had as professors, I am yet to meet someone with deep understanding of statistics who doesn't speak R as first language ... I found it way easier to grasp the meaning of statistics by playing with R than by reading the maths.

I used RStudio to work through problem sets, textbooks, and ideas constantly during my time as an applied math student. My concentration was stats, but still found RStudio invaluable for pretty much every math class I took. I say RStudio specifically because it offered the complete package for what I needed at the time. Built-in graph viewing, workspace management, etc. As another commenter said, pretty much the best graphing/scientific calculator I could ask for.

Re: One Year with R

#197
post #162
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…

import pandas as pd import matplotlib.pyplot as plt import matplotlib.dates as mdates import seaborn as sn df = (pd.read_csv("/tmp/overview_2022-03-21.csv") # i just used curl beforehand .assign(date=lambda x: pd.to_datetime(x["date"])) .set_index("date") .melt(value_vars=[ "newCasesBySpecimenDate", "covidOccupiedMVBeds", "newAdmissions", "newDeaths28DaysByDeathDate"], var_name="Data", ignore_index=False) .assign(Dat…

Check out plotnine. Really good clone of ggplot for python.

https://plotnine.readthedocs.io/en/stable/

Re: One Year with R

#198

Earlier quoted context omitted.

> 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…

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.

Re: One Year with R

#199

I first learned how to code in R before moving on to Python, then some C and Go. I think a big cause for the SWE hate of R is that it's not OO programing. R is a functional language for data analysis . If you don't grok that, then I can understand why looking at it would make you barf. Going the other way, from functional to OO, caused me physical pain as well. R is amazing for data analysis. Also, RStudio is a much…

I made the same transition from R to Python and I still resist using OO. I never understood why people would use it instead of functions.

Re: One Year with R

#200
post #16

Earlier quoted context omitted.

I don't understand the use case for SPSS. My local university is training their neuroscience researchers on it, which seems so odd in 2022 with Julia or python sitting right there.

Teaching someone who knows a bit of Excel and very little programming how to do statistical analysis in SPSS is easy and lets you focus on the statistics. Teaching them to do statistical analysis in Julia will involve you spending 80% of your time teaching them Julia and maybe 20% of your time teaching them statistical analysis.

I agree with you, though I wonder what's included in your definition of "do statistical analysis" ? Is it just using the stats functions as blackboxes without understanding what is going on under the hood?

I find using Python and/or R to be very helpful for teaching, since you can implement the stats procedures using primitives (prob. calculations), so you get some experience with how things work.

Sure it requires some "coding" but nothing harder than using a calculator, so I think it's worth learning.

Julia is a bit more involved (need to learn something about data types), but still would be manageable.

Post reply on HN