uniqueN(by=character()) returns nrow, as does by=NULL#4595
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4595 +/- ##
==========================================
+ Coverage 99.43% 99.61% +0.17%
==========================================
Files 73 73
Lines 14460 14120 -340
==========================================
- Hits 14379 14065 -314
+ Misses 81 55 -26
Continue to review full report at Codecov.
|
|
Should library(data.table)
DT <- data.table(idx=1:4, value="val")
uniqueN(DT, by = character(0))
#> Error in forderv(x, by = by, retGrp = TRUE, na.last = if (!na.rm) FALSE else NA): Internal error: DT has 2 columns but 'by' is either not integer or is length 0
uniqueN(DT, by = NULL)
#> [1] 4
unique(DT, by = character(0L))
#> Error in forderv(x, by = by, sort = FALSE, retGrp = TRUE): Internal error: DT has 2 columns but 'by' is either not integer or is length 0
unique(DT, by = NULL)
#> idx value
#> 1: 1 val
#> 2: 2 val
#> 3: 3 val
#> 4: 4 val
duplicated(DT, by = character(0L))
#> logical(0)
duplicated(DT, by = NULL)
#> [1] FALSE FALSE FALSE FALSE
anyDuplicated(DT, by = character(0L))
#> [1] 0
anyDuplicated(DT, by = NULL)
#> [1] 0 |
| error = 'specify non existing column*.*y') | ||
| test(1962.0061, duplicated(data.table(NULL)), logical(0L)) | ||
| test(1962.0062, duplicated(data.table(a = 1L), by = character()), logical()) | ||
| test(1962.006, duplicated(data.table(NULL)), logical(0L)) |
There was a problem hiding this comment.
this duplicated(., by=character()) was tested against for coverage before, we might count that as a breaking change?
cc @ColeMiller1
if so, maybe want to sneak it into the upcoming release as "potentially breaking"
|
We seem to have lost Travis CI, and therefore coverage. |
…ce that folk find the news item when searching for the error
Closes #4594
Not 100% sure this is the 'perfect' fix, but I think consistency with
by=NULLmakes sense, at least.