gpt4 book ai didi

R重复函数不处理无与伦比

转载 作者:行者123 更新时间:2023-12-01 11:33:44 25 4
gpt4 key购买 nike

我正在尝试使用 duplicated 来查找数据框中仅基于两列的重复行。

当我将任何东西传递给 incomparables 参数时,我得到了错误

dups = duplicated(data, incomparables="Age")
...
argument 'incomparables != FALSE' is not used (yet)

我想不通。

This question好像有类似的问题,没有反应。

毫无疑问,有不同的方法可以做同样的事情,这也很好,因为我是 R 的初学者。

最佳答案

首先,通过阅读 ?duplicated 的文档,您将意识到 incomparables 参数接受不应比较的值向量而不是列名,我引用:

a vector of values that cannot be compared.

还有更详细的

Values in incomparables will never be marked as duplicated. This is intended to be used for a fairly small set of values and will not be efficient for a very large set.

无论哪种方式,the source code意味着即使您按照文档进行操作也无法使用它,因为此功能似乎尚未实现

if(!identical(incomparables, FALSE))    
.NotYetUsed("incomparables != FALSE")

不过,回到您的问题,为了对两列运行 duplicated,您可以明确命名它们,例如

duplicated(data[c("col1", "col2")]) ## (if the desired columns called col1 and col2)

关于R重复函数不处理无与伦比,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29730006/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com