Skip to content

Commit 958e3dd

Browse files
Added tests for DT[, .SD] retaining secondary indices, #1709 (#6012)
* added tests for DT[, .SD] retaining secondary indices, #1709 * updated news.md * NEWS not needed * terminal newline --------- Co-authored-by: Michael Chirico <[email protected]>
1 parent 54f9048 commit 958e3dd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

inst/tests/tests.Rraw

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18350,3 +18350,12 @@ if (test_bit64) {
1835018350
apple = data.table(id = c("a", "b", "b"), time = c(1L, 1L, 2L), y = i64v[1:3])
1835118351
test(2248, dcast(apple, id ~ time, value.var = "y"), data.table(id = c('a', 'b'), `1` = i64v[1:2], `2` = i64v[4:3], key='id'))
1835218352
}
18353+
18354+
# Unit tests for DT[, .SD] retaining secondary indices, #1709
18355+
DT = data.table(x=1:5, y=6:10)
18356+
setindex(DT, x)
18357+
test(2249.1, indices(DT), 'x')
18358+
test(2249.2, indices(DT[, .SD]), 'x')
18359+
setindex(DT, y)
18360+
test(2249.3, indices(DT), c('x', 'y'))
18361+
test(2249.4, indices(DT[, .SD]), c('x', 'y'))

0 commit comments

Comments
 (0)