diff --git a/R/data.table.R b/R/data.table.R index 7e2085bb4..0f3b76616 100644 --- a/R/data.table.R +++ b/R/data.table.R @@ -1938,7 +1938,7 @@ replace_dot_alias = function(e) { return(suppPrint(x)) } if (is.null(ans)) { - ans = as.data.table.list(lapply(groups,"[",0L)) # side-effects only such as test 168 + ans = as.data.table.list(lapply(groups, `[`, 0L)) # side-effects only such as test 168 setnames(ans,seq_along(bynames),bynames) # TO DO: why doesn't groups have bynames in the first place? return(ans) } diff --git a/inst/tests/tests.Rraw b/inst/tests/tests.Rraw index 69a0dd9c4..ad3ad526c 100644 --- a/inst/tests/tests.Rraw +++ b/inst/tests/tests.Rraw @@ -5623,7 +5623,7 @@ test(1360.2, copy(dt)[sample, N := c(.N), by = .EACHI], copy(dt)[sample, N := .N # Fix for #500 - `lapply` call shouldn't redirect to `[.data.frame`. L <- list(data.table(BOD), data.table(BOD)) -test(1361, lapply(L, "[", Time==3L), list(L[[1L]][Time == 3L], L[[2L]][Time == 3L])) +test(1361, lapply(L, `[`, Time==3L), list(L[[1L]][Time == 3L], L[[2L]][Time == 3L])) # Feature #735, first two cases: 1) .SD, and 2) DT[, c(.SD, lapply(.SD, ...)), by=...] optimisation: # Don't set options(datatable.verbose=TRUE) here because the "running test 1362.1 ..." messages cause output to scroll away errors on CRAN checks last 13 lines @@ -18369,10 +18369,10 @@ test(2249.4, indices(DT[, .SD]), c('x', 'y')) # make names(.SD) work - issue #795 dt = data.table(a = 1:4, b = 5:8) -test(2250.01, dt[, names(.SD) := lapply(.SD, '*', 2), .SDcols = 1L], data.table(a = 1:4 * 2, b = 5:8)) -test(2250.02, dt[, names(.SD) := lapply(.SD, '*', 2), .SDcols = 2L], data.table(a = 1:4 * 2, b = 5:8 * 2)) +test(2250.01, dt[, names(.SD) := lapply(.SD, `*`, 2), .SDcols = 1L], data.table(a = 1:4 * 2, b = 5:8)) +test(2250.02, dt[, names(.SD) := lapply(.SD, `*`, 2), .SDcols = 2L], data.table(a = 1:4 * 2, b = 5:8 * 2)) test(2250.03, dt[, names(.SD) := lapply(.SD, as.integer)], data.table(a = as.integer(1:4 * 2), b = as.integer(5:8 * 2))) -test(2250.04, dt[1L, names(.SD) := lapply(.SD, '+', 2L)], data.table(a = as.integer(c(4, 2:4 * 2)), b = as.integer(c(12, 6:8 * 2)))) +test(2250.04, dt[1L, names(.SD) := lapply(.SD, `+`, 2L)], data.table(a = as.integer(c(4, 2:4 * 2)), b = as.integer(c(12, 6:8 * 2)))) test(2250.05, dt[, setdiff(names(.SD), 'a') := NULL], data.table(a = as.integer(c(4, 2:4 * 2)))) test(2250.06, dt[, c(names(.SD)) := NULL], null.data.table())