this gives an error in data.table 1.9.5 and whereas everything works under 1.9.4:
library(treemap) data(business) treemap(business, index=c("NACE1", "NACE2", "NACE3"), vSize="turnover", type="index")
Error in [.data.table(datlist, , paste0("index", 1:(i - 1)), with = FALSE) : column(s) not found: index4, index5
[.data.table
sessionInfo()
R version 3.2.1 (2015-06-18) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.2 LTS
locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C [9] 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] treemap_2.3
loaded via a namespace (and not attached): [1] igraph_1.0.0 Rcpp_0.11.6 magrittr_1.5 MASS_7.3-42 munsell_0.4.2 colorspace_1.2-6 xtable_1.7-4 gridBase_0.4-7 R6_2.0.1 stringr_1.0.0 plyr_1.8.3 tools_3.2.1 [13] grid_3.2.1 data.table_1.9.5 gtable_0.1.2 htmltools_0.2.6 digest_0.6.8 shiny_0.12.1 RColorBrewer_1.1-2 reshape2_1.4.1 ggplot2_1.0.1 mime_0.3 stringi_0.5-2 scales_0.2.5 [25] httpuv_1.3.2 chron_2.3-47 proto_0.3-10
You should let the treemap maintainer @mtennekes know, the error occurs in tmGenerateRect.R#L58
treemap
It seems to be a bug in data.table:
dt <- data.table(index1=1:10, index2=10:1, index3=1, s=4, i=24) i <- 2 dt[, paste0("index", 1:i), with=FALSE] # Error in `[.data.table`(dt, , paste0("index", 1:i), with = FALSE) : # column(s) not found: index4, index5 dt[, paste0("index", 1:2), with=FALSE] # No problems ii <- 2 dt[, paste0("index", 1:ii), with=FALSE] # Also no problems
slightly simplified:
library(data.table) i<-1 data.table(a1=1)[, paste0("a",i), with=FALSE] # a1 # 1: 1 data.table(a1=1, i=2)[, paste0("a",i), with=FALSE] # Error in `[.data.table`(data.table(a1 = 1, i = 2), , paste0("a", i), with = FALSE) : # column(s) not found: a2
Looks like a scoping issue with with=F and variable/column name collision.
with=F
Fix data.table 1.9.5 related issue: Rdatatable/data.table#1216
Activity
jangorecki commentedon Jul 9, 2015
You should let the
treemapmaintainer @mtennekes know, the error occurs in tmGenerateRect.R#L58mtennekes commentedon Jul 9, 2015
It seems to be a bug in data.table:
jangorecki commentedon Jul 9, 2015
slightly simplified:
Looks like a scoping issue with
with=Fand variable/column name collision.Fix data.table 1.9.5 related issue: Rdatatable/data.table#1216
Fix data.table 1.9.5 related issue: Rdatatable/data.table#1216