Skip to content

[R-Forge #5607] can not add new columns when the data.table is loaded from saved environment.  #479

Closed

Description

@arunsrinivasan

Submitted by: Chong Wang; Assigned to: Nobody; R-Forge link

when the data.table DT is saved to an environment and then reloaded, adding new columns doesn't have effect on the data.table. (see data.table B)

require(data.table)
env <- new.env(parent = emptyenv())
DT <- data.table(x = 1:3)
assign("DT", DT, envir=env)
env$DT[, y := 3]
A <- copy(env$DT)

save(env, file="temp.rda")   
rm (DT)
rm (env)

load("temp.rda")

env$DT[, z:=10]
B <- copy(env$DT)

env$DT <- copy(env$DT)
env$DT[, z:=10]
C <- copy(env$DT)

Now, looking at the data.tables A, B and C:

A
#    x y
#1: 1 3
#2: 2 3
B
#    x y
#1: 1 3
#2: 2 3
C
#    x y  z
#1: 1 3 10
#2: 2 3 10

In principal, B should have the same content as C.

Thanks!

Activity

  1. added this to the v1.9.6 milestone on Sep 24, 2014
  2. modified the milestones: v1.9.6, v1.9.8 on Oct 10, 2014
  3. modified the milestones: v1.9.6, v1.9.8 on Jan 28, 2015
  4. added a commit that references this issue on Jan 28, 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