Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
We are deprecating filterD()
from the next version of FSA (v0.9.0). It will likely be removed by the start of 2022. filterD()
was an attempt to streamline the process of using filter()
(from dplyr
) followed by droplevels()
to remove levels of a factor variable that no longer existed in the filtered data frame.
For example, consider the very simple data frame below.
Now suppose that this data frame is reduced to just Bluegill.
A quick frequency table of species caught shows that levels for species that no longer exist in the data frame are maintained.
This same “problem” occurs when using subset()
from base R.
These “problems” can be eliminated by submitting the new data frame to drop.levels()
.
filterD()
was a simple work-around that eliminated this second step and was useful for helping students who were just getting started with R.
However, this is a hacky solution to a simple problem. Thus, we are deprecating filterD()
from FSA
with plans to remove it by the beginning of next year. Thus, please use droplevels()
(or fct_drop()
from forcats
) after using filter()
to accomplish the same task of the soon to be defunct filterD()
.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.