What is Nostr?
Jonathan Carroll /
npub1kl6…gf30
2024-03-25 00:34:10

Jonathan Carroll on Nostr: Ooh! I think #rstats is getting a base equivalent of `dplyr::arrange()` ...

Ooh! I think #rstats is getting a base equivalent of `dplyr::arrange()`

https://fosstodon.org/@R_devs_news/112153323397378528

Farewell,

d[order(d$col), ]

... you served me well, even though, that's exactly the default implementation of the new sort_by() and it will retain the duplication

sort_by(mtcars, mtcars$am)

What's *really* interesting is that it's going to take a formula https://github.com/wch/r-source/blob/01416a961c22b1a585ba1aa4e83e14397f0885ff/src/library/base/R/sort_by.R#L20

sort_by(mtcars, ~ am + mpg)

and a perhaps not-so-pretty way to reverse sort

sort_by(mtcars, ~ am + I(-mpg))
Author Public Key
npub1kl6fnrhma07s6e67qecufyhhvyx8emckuase0x9u0emprjltzrrqeggf30