Skip to content

Feature Request: Allow fct_reorder to Work with Non-Numeric Results of .fun #147

@billdenney

Description

@billdenney

This is the same issue as #103 with a different request.

It seems as though fct_reorder() and fct_reorder2() should only require that the results of the function are sortable not that they are numeric. Lexicographical order for the below is consistent and well-defined, but a simple numerical mapping can be more complex when the input isn't as simple as the below.

My feature request is: Can fct_reorder() and fct_reorder2() please allow non-numeric values? It seems like it could be as simple as running xtfrm() on the results of .fun.

Related to this, can the documentation be updated to indicate what the return value of .fun() must be?

library(forcats)
fct_reorder(.f=LETTERS[1:3], .x=LETTERS[4:6], .fun=min)
#> Error: `fun` must return a single number per group

Created on 2018-09-11 by the reprex package (v0.2.0).

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancementtidy-dev-day 🤓Tidyverse Developer Day rstd.io/tidy-dev-day

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions