Skip to content

:= changes address of a data table #1729

@vspinu

Description

@vspinu

I have narrowed down this to a specific dataset which I attach. It happens only when loaded from rds. If I read same data with fread the problem does not occur.

I am disguising rds file with txt extension in order to be able to upload it to github.

address_change <- function(df){
    cat("address before:", address(df), "\n")
    df[, c("new_var") := 1]
    cat("address after:", address(df), "\n")
}

tt <- readRDS("tt.txt")
address_change(tt)
"new_var" %in% names(tt)

I see consistent change of address on every trial:

> address_change(tt)
address before: 0x8aacf60 
address after: 0xbd35150 
> "new_var" %in% names(tt)
[1] FALSE

Any ideas of how to get around this without a copy?

devtools::session_info("data.table")
Session info ---------------------------------------------------------------------------------------------------------
 setting  value                                 
 version  R version 3.2.4 RC (2016-03-02 r70278)
 system   x86_64, linux-gnu                     
 ui       X11                                   
 language                                       
 collate  C                                     
 tz       Europe/Amsterdam                      
 date     2016-06-05                            

Packages -------------------------------------------------------------------------------------------------------------
 package    * version date       source                                
 data.table * 1.9.7   2016-06-01 Github (Rdatatable/data.table@6c12e25)

tt.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions