You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a logical vector in j to select columns dynamically (StackOverflow), using the abbreviations T/F has different behavior than using TRUE/FALSE
#Minimal reproducible example
library(data.table)
#> Warning: package 'data.table' was built under R version 4.0.3DT= data.table(x=rep(c("a","b","c"),each=3), y=c(1,3,6), v=1:9)
DT[, c(TRUE, TRUE, FALSE), verbose=TRUE]
#> x y#> 1: a 1#> 2: a 3#> 3: a 6#> 4: b 1#> 5: b 3#> 6: b 6#> 7: c 1#> 8: c 3#> 9: c 6DT[, c(T, T, F), verbose=TRUE]
#> Detected that j uses these columns: <none>#> [1] TRUE TRUE FALSE# `with = FALSE` still works as expected, though should no longer be necessary# per https://stackoverflow.com/a/33301945/6197649DT[, c(T, T, F), with=FALSE, verbose=TRUE]
#> x y#> 1: a 1#> 2: a 3#> 3: a 6#> 4: b 1#> 5: b 3#> 6: b 6#> 7: c 1#> 8: c 3#> 9: c 6
#Output of sessionInfo()
sessionInfo()
#> R version 4.0.2 (2020-06-22)#> Platform: x86_64-w64-mingw32/x64 (64-bit)#> Running under: Windows 10 x64 (build 18363)#> #> Matrix products: default#> #> locale:#> [1] LC_COLLATE=English_Europe.1252 LC_CTYPE=English_Europe.1252 #> [3] LC_MONETARY=English_Europe.1252 LC_NUMERIC=C #> [5] LC_TIME=English_Europe.1252 #> #> attached base packages:#> [1] stats graphics grDevices utils datasets methods base #> #> other attached packages:#> [1] data.table_1.13.4#> #> loaded via a namespace (and not attached):#> [1] compiler_4.0.2 magrittr_1.5 tools_4.0.2 htmltools_0.5.0#> [5] yaml_2.2.1 stringi_1.4.6 rmarkdown_2.3 highr_0.8 #> [9] knitr_1.29 stringr_1.4.0 xfun_0.16 digest_0.6.25 #> [13] rlang_0.4.7 evaluate_0.14
The text was updated successfully, but these errors were encountered:
eaurele
changed the title
TRUE/FALSE and their abbreviated variants T/F have different behavior when used in j
TRUE/FALSE and abbreviated variants T/F have different behavior when used in j
Dec 15, 2020
making workaround for that in data.table will probably be tricky because there might be T/F fields in data.table, or user defined variables in parent scope.
When using a logical vector in
j
to select columns dynamically (StackOverflow), using the abbreviationsT
/F
has different behavior than usingTRUE
/FALSE
#
Minimal reproducible example
#
Output of sessionInfo()
Created on 2020-12-15 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: