shallow: shallow copy a 'data.table'

Description Usage Arguments Value Examples

Description

Convenience function to shallow copy a data.table (until this function is exported in the data.table package). For internal use only.

Usage

1
shallow(x, cols = names(x), reset_class = FALSE)

Arguments

x

A data.table.

cols

Character vector of column names (from x).

reset_class

logical (default FALSE). If TRUE, resets the class to "data.table", "data.frame".

Value

A shallow copied data.table.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
# For internal use only
library(data.table)
x <- data.table(a=1:2, b=3:4)
setattr(x, 'class', c("tmp", class(x)))

y <- gread:::shallow(x) # only copies column pointers
class(y) # class(x) is retained

## End(Not run)

openanalytics/gread documentation built on May 24, 2019, 2:29 p.m.