Skip to content

treemap and data.table 1.9.5 problem #1216

Closed

Description

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

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

Activity

  1. jangorecki commented on Jul 9, 2015

    @jangorecki
    Member

    You should let the treemap maintainer @mtennekes know, the error occurs in tmGenerateRect.R#L58

  2. mtennekes commented on Jul 9, 2015

    @mtennekes

    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
    
  3. jangorecki commented on Jul 9, 2015

    @jangorecki
    Member

    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.

  4. added this to the v1.9.6 milestone on Jul 10, 2015
  5. removed their assignment
    on Jul 17, 2015
  6. modified the milestones: v1.9.8, v1.9.6 on Jul 17, 2015
  7. modified the milestones: v1.9.6, v1.9.8 on Sep 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions