[R] duplicated() on zero-column data frames returns empty
Ivan Krylov
|kry|ov @end|ng |rom d|@root@org
Sun Apr 7 10:00:51 CEST 2024
В Fri, 5 Apr 2024 16:08:13 +0000
Jorgen Harmse <JHarmse using roku.com> пишет:
> if duplicated really treated a row name as part of the row then
> any(duplicated(data.frame(…))) would always be FALSE. My expectation
> is that if key1 is a subset of key2 then all(duplicated(df[key1]) >=
> duplicated(df[key2])) should always be TRUE.
That's a good argument, thank you!
Would you suggest similar changes to duplicated.matrix too? Currently
it too returns 0-length output for 0-column inputs:
# 0-column matrix for 0-column input
str(duplicated(matrix(0, 5, 0)))
# logi[1:5, 0 ]
# 1-column matrix for 1-column input
str(duplicated(matrix(0, 5, 1)))
# logi [1:5, 1] FALSE TRUE TRUE TRUE TRUE
# a dim-1 array for >1-column input
str(duplicated(matrix(0, 5, 10)))
# logi [1:5(1d)] FALSE TRUE TRUE TRUE TRUE
--
Best regards,
Ivan
More information about the R-help
mailing list