rdplyrdtplyr

semi_join and anti_join functions creating dtplyr objects instead of data frames


So I'm working on a project which requires me to combine dataframes with semi_join and anti_join from dplyr. However, instead of creating a data.frame as output, I get a dtplyr_step_subset object which I am unable to use and I have no idea how it works. (Note that this only happened after I updated my tidyverse package) Is there some argument for the join functions that fixes this?


Solution

  • It's difficult to know for certain without a reproducible example. But my best guess is that it is probably using semi_join from dtplyr, which gives you a data.table. In general to avoid overlapping functions from different packages, I recommend specifying the package for functions. So, you would use dplyr::semi_join() and dplyr::anti_join(). Also, if you don't need dtplyr then you can always detach it via detach("package:dtplyr", unload=TRUE).