data.table (version 1.9.4)

setDF: Convert a data.table to data.frame by reference

Description

In data.table parlance, all set* functions change their input by reference. That is, no copy is made at all, other than temporary working memory, which is as large as one column.. The only other data.table operator that modifies input by reference is :=. Check out the See Also section below for other set* function data.table provides.

A helper function to convert a data.table to data.frame by reference. It does not handle lists or lists of data.tables.

Usage

setDF(x)

Arguments

x
A data.table.

Value

  • The input data.table is modified by reference to a data.frame.

Details

This feature request came up on the data.table mailing list: http://bit.ly/1xkokNQ. All data.table attributes including any keys of the input data.table are stripped off.

See Also

setkey, setattr, setnames, set, :=, setorder, copy, setDT html{}

Examples

Run this code
X = data.table(x=1:5, y=6:10)
## convert 'X' to data.frame, without any copy.
setDF(X)

Run the code above in your browser using DataLab