New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
arunsrinivasan opened this Issue Jun 8, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@arunsrinivasan
Member

arunsrinivasan commented Jun 8, 2014

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!

@arunsrinivasan arunsrinivasan added this to the v1.9.6 milestone Sep 24, 2014

@arunsrinivasan arunsrinivasan modified the milestones: v1.9.6, v1.9.8 Oct 10, 2014

@arunsrinivasan arunsrinivasan modified the milestones: v1.9.6, v1.9.8 Jan 28, 2015

@arunsrinivasan arunsrinivasan self-assigned this Jan 28, 2015

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