Skip to content

Feature Request: Add handling of ordered factors to fct() #363

Description

@sambtalcott

I would like to see the fct() function from forcats be extended to cover creating ordered factors. This could look like including ordered as an optional argument (as in base::factor()) and/or by creating an analogue function ord() that has the same default level-checking as fct().

In practice this would look like:

x <- c("A", "B", "A", "C", "A", "B", "D")
lvls <- c("F", "D", "C", "B", "A")

x <- fct(x, lvls, ordered = TRUE)

# and/or
x <- ord(x, lvls)

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions