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: Allow Increasing Order in fct_infreq #365

Open
drfloren opened this issue Jul 1, 2024 · 0 comments
Open

Feature Request: Allow Increasing Order in fct_infreq #365

drfloren opened this issue Jul 1, 2024 · 0 comments

Comments

@drfloren
Copy link

drfloren commented Jul 1, 2024

Current implementation has fct_infreq locked in descending order. Request is to passthrough an argument to order allowing both directions.

Current version is:

fct_infreq <- function(f, w = NULL, ordered = NA) {
  f <- check_factor(f)
  w <- compute_weights(f, w)
  check_bool(ordered, allow_na = TRUE)

  lvls_reorder(f, order(w, decreasing = TRUE), ordered = ordered)
}

Example with update would be something like:

fct_infreq <- function(f, w = NULL, ordered = NA, desc = TRUE) {
  f <- check_factor(f)
  w <- compute_weights(f, w)
  check_bool(ordered, allow_na = TRUE)

  lvls_reorder(f, order(w, decreasing = desc), ordered = ordered)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant