Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sambtalcott opened this issue Jun 18, 2024 · 0 comments
Open

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

sambtalcott opened this issue Jun 18, 2024 · 0 comments
Labels
feature a feature request or enhancement

Comments

@sambtalcott
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants