简体   繁体   English

semi_join 和 anti_join 函数创建 dtplyr 对象而不是数据帧

[英]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.所以我正在做一个项目,该项目需要我将数据帧与来自 dplyr 的 semi_join 和 anti_join 结合起来。 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.但是,我没有创建一个 data.frame 作为 output,而是得到一个 dtplyr_step_subset object,我无法使用它,我不知道它是如何工作的。 (Note that this only happened after I updated my tidyverse package) Is there some argument for the join functions that fixes this? (请注意,这只发生在我更新了我的 tidyverse 包之后)连接函数是否有一些参数可以解决这个问题?

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 .但我最好的猜测是它可能使用了semi_joindtplyr ,它给了你一个data.table In general to avoid overlapping functions from different packages, I recommend specifying the package for functions.一般来说,为了避免不同包中的函数重叠,我建议为函数指定 package。 So, you would use dplyr::semi_join() and dplyr::anti_join() .因此,您将使用dplyr::semi_join()dplyr::anti_join() Also, if you don't need dtplyr then you can always detach it via detach("package:dtplyr", unload=TRUE) .此外,如果您不需要dtplyr ,那么您可以随时通过detach("package:dtplyr", unload=TRUE)将其分离。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM