duplicated(x, fromLast=FALSE, by=seq_along(x),)
- X : A data.table. uniqueN accepts atomic vectors and data.frames as well.
- fromLast : logical indicating if duplication should be considered from the reverse side, i.e., the last (or rightmost) of identical elements would correspond to duplicated = FALSE.
- by : character or integer vector indicating which combinations of columns from x to use for uniqueness checks. By default all columns are being used. That was changed recently for consistency to data.frame methods.
- returns a logical vector of length nrow(x) indicating which rows are duplicates.
duplicated(DT, by="B")
duplicated(DT, by=c("A", "C"))
duplicated(DT, by="B", fromLast=TRUE)
# 注意返回的是nrow(x)等长的包含逻辑值的向量
最后
以上就是笨笨啤酒最近收集整理的关于R -- duplicated函数的全部内容,更多相关R内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复