HNHacker News
TopNewBestAskShowJobs

hadley

1,296 karma · joined January 15, 2008

http://had.co.nz
submissionscomments
hadley··on The case for a pipe assignment operator in R
There are few differences in performance due between the base pipe and magrittr due to the work we did in 2.0.0: https://www.tidyverse.org/blog/2020/11/magrittr-2-0-is-here/.

This release also cleaned up some edge cases so that the semantics are as similar as possible too, making it easy for folks to switch between the two.

hadley··on The case for a pipe assignment operator in R
Just a small note that R is not pass-by-value, it’s more copy-on-modify. See some of the details at https://adv-r.hadley.nz/names-values.html
hadley··on Nota is a language for writing documents, like academic papers and blog posts
Quarto will support output to typst in the upcoming 1.4 release: https://quarto.org/docs/prerelease/1.4/typst.html

I think the big different between quarto and typst is the scope. quarto is a tool for combining prose and computation to generate many different output types (HTML, PDF (via latex), PDF (via typst), PPT, ...) through the power of markdown/pandoc. typst is a typesetting system for turning plain-text markup in to beautiful PDFs.

I think you're much more likely to want to write typst by hand than latex, but out of the box it doesn't provide any tooling for combining writing and computing (if that matters to you).

hadley··on Lets-Plot: An open-source plotting library for statistical data
A scale isn’t exactly a function because it also needs the inverse in order to draw axes and legends. And it turns out axes and legends are where most of the complexity of scales lie.
hadley··on One Year with R
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)

hadley··on One Year with R
Have you seen https://dtplyr.tidyverse.org? It gives you the syntax of dtplyr and (almost all of) the speed of data.table.
hadley··on One Year with R
They don't often come with code, but one of my recent sources of R programming joy is the folks posting their generative art to twitter: https://twitter.com/search?q=%23rstats%20%23generativeart&sr...
hadley··on One Year with R
Ah yeah, connecting the dots in ggplot2 docs is hard. It's hard for us to document because, under the hood, the pieces quite decoupled and different pieces are responsible for different arguments. But since we last took a deep dive on the ggplot2 docs, we've gotten much better at generating docs with code, so maybe it's time to have another look. I've filed an issue (https://github.com/tidyverse/ggplot2/issues/4770) so we don't forget about it, but no guarantees about when it might get done.
hadley··on One Year with R
I love the phrase "eviscerate a fresh data set" :D
hadley··on One Year with R
100% this :)
hadley··on One Year with R
Do you have any specific examples that illustrate the general problem? I'd love to better understand what you're looking for in docs.
hadley··on PRQL – A proposal for a better SQL
Yeah, that's my current position. It's possible that we might be able to add it in optionally (by adding a new `.by` argument to summarise and friends), but just the analysis to determine how it would affect existing code is a lot of work.
hadley··on PRQL – A proposal for a better SQL
From dbplyr experience, folks want to be able to do stuff like `across(which(is.numeric), mean)`, which you can't do currently because dplyr doesn't know the column types (although it does maintain a list of the column names).
hadley··on PRQL – A proposal for a better SQL
acquero uses derive (https://uwdata.github.io/arquero/api/verbs#derive) which I rather like (it's better than mutate, IMO)
hadley··on PRQL – A proposal for a better SQL
FWIW the separate `group_by()` is one of my greatest design regrets with dplyr — I wish I had made `by` a parameter of `summarise()`, `mutate()`, `filter()` etc.
hadley··on Modern Text Features in R
We are in the middle of a process to systematically re-license as much as possible as MIT. More on that soon.
hadley··on Pandoc – A universal document converter
Could you shoot me an email? I’m always on the lookout for pandoc freelancers.
hadley··on RStudio becomes a public benefit corporation
Doh - I filed an issue on our internal tracker to fix this
hadley··on An opinionated view of the Tidyverse “dialect” of the R language
A lot depends on what you’re doing. Most of the time, when I’m not doing data analysis, I don’t find pipes to be that useful so I don’t use them.
hadley··on An opinionated view of the Tidyverse “dialect” of the R language
Beware that apply() coerces data frames to matrices, which is time consuming and forces all columns to have the same type.
hadley··on An opinionated view of the Tidyverse “dialect” of the R language
Let’s keep the discussion civil please. People have legitimately different needs, and just because a package isn’t well suited to your needs doesn’t mean that it doesn’t help people with different backgrounds and goals.
hadley··on An opinionated view of the Tidyverse “dialect” of the R language
I don’t think anyone is arguing that the pipe should be the -only- form of composition. Just that it’s a useful form when you have a linear sequence of transformations. Sometimes it’s useful to force something close to being linear into a linear form for consistency, but typically you would switch to an alternate form of composition, typically assigning to intermediate variables.

It’s easy to find examples of using the pipe in ways that I would consider suboptimal. But that doesn’t affect my thesis that, on average, the use of the pipe leads to more readable code.

I was also initially quite sceptical of the pipe, since it is a fundamentally new syntax for R (although obviously used in many other languages). I think the uptake by a wide variety of people across the R community does suggest there’s something there.

hadley··on An opinionated view of the Tidyverse “dialect” of the R language
Pretty much all of the individual components of the tidyverse were created before the tidyverse since it’s only 3 years old.

But there’s no reason to use only the tidyverse. That’s not something I’ve ever recommended and it would be extremely hard. I just object to people claiming that some of the most important parts of the tidyverse aren’t actually parts of it.

hadley··on An opinionated view of the Tidyverse “dialect” of the R language
If you find data.table more useful, you should by all means use it.

My greatest regret about coining the word tidyverse is that for some reason people seem to think it’s a monolith. It’s not; you’re totally free to pick and choose whatever parts of it you find useful.

It doesn’t hurt my feelings if packages that I have help write aren’t the perfect fit for your problems. Use whatever makes you happy :)

hadley··on An opinionated view of the Tidyverse “dialect” of the R language
You are of course free to dispute what is in the tidyverse, but I pretty strongly believe that it is part of the tidyverse
hadley··on Lego Mosaics Using R
I think that is good advice but it’s not a great fit for R packages due to the requirements that CRAN has for package submission. I’ve wrapped up my recommended practices in usethis::use_mit_license().
hadley··on Faster R with FastR
dplyr does not do deep copies. See discussion in https://adv-r.hadley.nz/names-values.html#df-modify
hadley··on HyperTools: A Python toolbox for gaining insights into high-dimensional data
You should take a look at tourrr which implements a bunch of "grand tour" algorithms in R. These take your on a smooth tour of random projections of your data, visualised in various ways (including into 3d if you have some red-blue 3d glasses!)
hadley··on Ursa Labs: an innovation lab for open source data science
It should make things a bit faster, and a bit easier to collaborate with people using other languages.
hadley··on You Can’t Do Data Science in a GUI
I love exploratory - it's an a really interesting place between GUI and code autocomplete on steroids,
← PreviousPage 2 of 11Next →