Skip to content

Feature Request: Allow Increasing Order in fct_infreq #365

Open
@drfloren

Description

@drfloren

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)
}

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