Skip to content

DT assign by ref not accept list col as RHS, error msg misleading #950

@jangorecki

Description

@jangorecki

Checked on the current latest DT version.
Take the two cols DT where second is list of functions:

DT <- data.table(id=c("a","b"), f=list(function(x) x*2, function(x) x^2), key="id")
lapply(DT,class)
DT[.("a"),f:=list(function(x) x^3)]
#> Error in `[.data.table`(DT, .("a"), `:=`(f, list(function(x) x^3))) : 
#>  RHS of assignment is not NULL, not an an atomic vector (see ?is.atomic) and not a list column.

Expected results would be to update by reference the f column in DT for row id=="a".
Error states that RHS is not a list which is not true. It does not update DT.

sessionInfo()

R version 3.1.2 (2014-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

other attached packages:
 [1] devtools_1.6.1   RPostgreSQL_0.4  DBI_0.3.1        logR_1.0.3       Rbitcoin_0.9.3.9 data.table_1.9.5 TTR_0.22-0       xts_0.9-7        zoo_1.7-11      

loaded via a namespace (and not attached):
[1] chron_2.3-45    digest_0.6.4    grid_3.1.2      httr_0.5        jsonlite_0.9.13 lattice_0.20-29 RCurl_1.95-4.3  stringr_0.6.2   tools_3.1.2  

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions