DataFramesMeta.jl icon indicating copy to clipboard operation
DataFramesMeta.jl copied to clipboard

Request: `@order` to mimic `DataFrames.order` in `@orderby`

Open rben01 opened this issue 2 years ago • 1 comments

Currently, DataFramesMeta doesn't really support custom sorting options in an @orderby (although descending sort is supported through other Julia functions). It would be nice if you could mimic the following DataFrames syntax:

sort(df, order(:a, rev=true))

using something like

@orderby df @order(:a, rev=true)

rben01 avatar Aug 02 '23 15:08 rben01

Thanks!

Some of this is discussed in the dplyr tutorial here. I think the best solution is to use ordinalrank from StatsBase.jl

@orderby df ordinalrank(:x, rev = true)

pdeffebach avatar Aug 02 '23 15:08 pdeffebach

I'm going to close this. I know the current behavior isn't perfect, but I think it's good enough to use without adding too many complications to the codebase.

pdeffebach avatar Mar 01 '24 14:03 pdeffebach