You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes you want to drop one or two specific unused factor levels but you don't want to drop all of the unused factor levels. For example, you might have the following factor from survey data
where you'd be interested in removing the 'Undecided' level but not the 'Independent' level, even though both are unused. In such a case, you would essentially want to use a version of fct_drop() that doesn't drop every unused level but instead allows finer control over which levels are dropped.
A simple example of such a function would be the following:
Forcats seems like the best package to have a function that would clearly accomplish this. Unless this is already implemented elsewhere, perhaps this could be implemented using arguments to fct_drop() or as a new function in forcats.
The text was updated successfully, but these errors were encountered:
What should the function do if you request to drop a level that has values? Silently ignore and only drop levels that don't have any values? Or throw an error? Or silently replace all named levels with NA?
Sometimes you want to drop one or two specific unused factor levels but you don't want to drop all of the unused factor levels. For example, you might have the following factor from survey data
where you'd be interested in removing the 'Undecided' level but not the 'Independent' level, even though both are unused. In such a case, you would essentially want to use a version of
fct_drop()
that doesn't drop every unused level but instead allows finer control over which levels are dropped.A simple example of such a function would be the following:
Forcats seems like the best package to have a function that would clearly accomplish this. Unless this is already implemented elsewhere, perhaps this could be implemented using arguments to
fct_drop()
or as a new function in forcats.The text was updated successfully, but these errors were encountered: