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 fctlump* 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 https://github.com/tidyverse/forcats/issues/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 https://github.com/tidyverse/forcats/issues/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 https://github.com/tidyverse/forcats/issues/266).
fct_unique() now captures implicit missing values if present
Feature Type
[X] Adding new functionality to datar
[X] 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 offct_na_value_to_level()
fct_expand()
gains anafter
argument so that you can choose where the new levels are placedfct_infreq()
gains the ability to weight by another variable using thew
argumentfct_inorder()
now works when not all levels appear in the datafct_lump_prop()
and friends now work correctly if you supply weights and have empty levelsfct_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 fctlump* functionsfct_other()
no longer generates a warning if no levels are replaced with otherfct_relevel()
,fct_cross()
, andfct_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 https://github.com/tidyverse/forcats/issues/319).fct_reorder()
andfct_reorder2()
now remove NA values in_x
with a warning. You can suppress the warning by setting_na_rm
= True (see also https://github.com/tidyverse/forcats/issues/315).fct_reorder()
andfct_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 https://github.com/tidyverse/forcats/issues/266).fct_unique()
now captures implicit missing values if presentAdditional Context
No response