Based upon the description of complete its purpose is to add missing observations for specific combinations of variable values. I believe therefore it is not very intuitive for it to silently drop observations if certain levels are not present, for example:
mutate( Species = as.character(Species)) %>%
complete( Species = c("versicolor", "virginica"))
This code silently drops all observations with Species = setosa
I would propose either changing the function to use a full_join() to ensure the original data is preserved or at the very least adding a warning/message so the user is aware that data has been lost.
I am happy to make a PR if people agree this is a beneficial change.
The text was updated successfully, but these errors were encountered:
changed the title
Using complete with missing levels silently drops observationsSep 10, 2018