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
> as.data.table(mtcars)[1:5, on = NULL]
Error in `[.data.table`(as.data.table(mtcars), 1:5, on = NULL) :
logical error. i is not a data.table, but 'on' argument is provided.
This is problematic when setting on conditionally, as with if or switch. I don't think R allows an expression to return a value that will make missing(on) true. You'd have to construct your [ call with do.call or bquote or something.
This behavior is also inconsistent with the documentation: the usage section of data.table-package states that on defaults to NULL.
Output of sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 20.04.6 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
time zone: America/New_York
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] data.table_1.16.2
loaded via a namespace (and not attached):
[1] compiler_4.4.0 tools_4.4.0 yaml_2.3.8 renv_1.0.5
The text was updated successfully, but these errors were encountered:
This is problematic when setting
on
conditionally, as withif
orswitch
. I don't think R allows an expression to return a value that will makemissing(on)
true. You'd have to construct your[
call withdo.call
orbquote
or something.This behavior is also inconsistent with the documentation: the usage section of
data.table-package
states thaton
defaults toNULL
.Output of
sessionInfo()
The text was updated successfully, but these errors were encountered: