Skip to content

[R-Forge #5204] Fail to add new column within functions when column quota is reached #496

Description

@arunsrinivasan

Submitted by: Huashan Chen; Assigned to: Nobody; R-Forge link

As raised here.

Activity

  1. jangorecki commented on Apr 5, 2020

    @jangorecki
    Member

    reproducible example

    d = data.table()
    f = function(d, n) {
      for (i in 1:n) d[, paste0("V",i) := i]
    }
    getOption("datatable.alloccol")
    #[1] 1024
    f(d, 1200)
    ncol(d)
    #[1] 1024 ## should be 1200!
  2. ben-schwen commented on May 9, 2021

    @ben-schwen
    Member

    Its also inconsistent with set

    d = data.table()
    f2 = function(d, n) {
      for (i in 1:n) set(d, j = paste0("V",i), value = i)
    }
    f2(d, 1200)
    
    Error in set(d, j = paste0("V", i), value = i) : 
      Internal error: DT passed to assign has not been allocated enough column slots. l=1024, tl=1024, adding 1
  3. ben-schwen commented on Oct 4, 2021

    @ben-schwen
    Member

    This seems also similar to #1633

  4. MichaelChirico commented on Jul 5, 2025

    @MichaelChirico
    Member

    I think it's definitely a dup of #1633, I added the set() example there and also one that doesn't use for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions