Skip to content

Feature Request: Map one Factor to Another #144

Open
@billdenney

Description

@billdenney

I often need to map a factor to another variable that either is already a factor or I need to make into a factor.

Would you consider including something like the following?

fct_mirror <- function(.f, .x) {
  factor(.x, levels=levels(.f), ordered=is.ordered(.f))
}

(This would solve an issue similar to tidyverse/dplyr#3731 by allowing fct_mirror(my_factor, case_when(...)).)

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