Skip to content

fct_reorder() treatment of missing values in .x depends on whether .f is a factor or a character vector #359

@dominikbach

Description

@dominikbach

When .x contains missing values, this throws an error if .f is a character vector but not if .f is a factor (with no missing values in either case).

This behaviour is not documented (and I suspect is not intended). It occurs in v0.5.0 and v1.0.0.

Example:

.f <- c("a", "b", "c")
.x <- c(1, 2, NA)
forcats::fct_reorder(.f, .x)
forcats::fct_reorder(forcats::as_factor(.f), .x)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions