Skip to content

[ENH] Support forcats 1.0.0 #191

@pwwang

Description

@pwwang

Feature Type

  • Adding new functionality to datar

  • Changing existing functionality in datar

  • Removing existing functionality in datar

Problem Description

Feature Description

  • New fct() which works like factor() but errors if values of x
    are not included in the levels specification

  • first2() and last2() now ignore missing values in both x and y

  • add fct_na_value_to_level()

  • fct_explicit_na() is deprecated in favour of fct_na_value_to_level()

  • fct_expand() gains an after argument so that you can choose where
    the new levels are placed

  • fct_infreq() gains the ability to weight by another variable using the w
    argument

  • fct_inorder() now works when not all levels appear in the data

  • fct_lump_prop() and friends now work correctly if you supply weights
    and have empty levels

  • fct_lump_n() and fct_lump_prop() will now create an "Other" level even
    if it only consists of a single level. This makes them consistent with the
    other fct_lump_* functions

  • fct_other() no longer generates a warning if no levels are replaced with
    other

  • fct_relevel(), fct_cross(), and fct_expand() now error if you name the
    arguments in **kwargs since those names are ignored and your code probably
    doesn't do what you think it does (see also fct_relevel() should gain fct_recode() functionality tidyverse/forcats#319).

  • fct_reorder() and fct_reorder2() now remove NA values in _x with a
    warning. You can suppress the warning by setting _na_rm = True (see also fct_reorder() yields unexpected result in presence of missing values tidyverse/forcats#315).

  • fct_reorder() and fct_reorder2() gain a new _default argument that
    controls the placement of empty levels (including levels that might become
    empty after removing missing values in _x) (see also fct_reorder() needs na_last argument tidyverse/forcats#266).

  • fct_unique() now captures implicit missing values if present

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions