Skip to content

by sometimes fails when it invokes get #4981

@OfekShilon

Description

@OfekShilon
> tmp <- data.table(a=c(1,2), b=c(3,4), c=c(1,0))
> tmp[,.(suma=sum(a)), keyby=.(b=get("b"),c)]   # succeeds
   b c suma
1: 3 1    1
2: 4 0    2
> tmp[2,.(suma=sum(a)), keyby=.(b=b,c)]  # succeeds
   b c suma
1: 4 0    2
> tmp[2,.(suma=sum(a)), keyby=.(b=get("b"))]   # succeeds
   b suma
1: 4    2
> tmp[2,.(suma=sum(a)), keyby=.(b=get("b"),c)]   # Fails! - when `i` is non empty and `keyby` contains an additional direct column
Error in get("b") : object 'b' not found

# Output of sessionInfo()
R version 3.4.0 (--) # Reproduces on R4.0.0 too
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.5 LTS

Matrix products: default
BLAS: /opt/R-3.4.0.mkl/lib64/R/lib/libR.so
LAPACK: /opt/R-3.4.0.mkl/lib64/R/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=C LC_COLLATE=C LC_MONETARY=C
[6] LC_MESSAGES=C LC_PAPER=C LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=C LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] data.table_1.14.1

loaded via a namespace (and not attached):
[1] compiler_3.4.0 tools_3.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    programmingparameterizing queries: get, mget, eval, env

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions