I work with data.table
in R that contain metadata (stored in the "comment" attribute), which provides a timestamp for the data. With a subset of data.table, metadata is discarded. For example,
library(data.table)
dt <- data.table(x = c(1:5), y = c(6:10))
setattr(dt, 'comment', 'december 10, 2015')
comment(dt)
comment(dt[x < 3])
data.frame
, on the other hand, does not exhibit the same behavior. For example,
df <- data.frame(x = c(1:5), y = c(6:10))
comment(df) <- "december 2015"
comment(df)
comment(df[df$x < 3, ])
Does anyone know if there is a way to store data.table
metadata in these subsets?
source
share