rebuild {cheapr} | R Documentation |
Rebuild an object from a template
Description
Rebuild an object from a template
Usage
rebuild(x, template, ...)
## S3 method for class 'data.frame'
rebuild(x, template, shallow_copy = TRUE, ...)
## S3 method for class 'data.table'
rebuild(x, template, shallow_copy = TRUE, ...)
Arguments
x |
An object in which carefully selected attributes
will be copied into from |
template |
A template object used to copy attributes into |
... |
Further arguments passed onto methods. |
shallow_copy |
Should |
Details
In R attributes are difficult to work with. One big reason for this is that attributes may or may not be independent of the data. Date vectors for example have attributes completely independent of the data and hence if the attributes are removed at any point, they can easily be re-added without any calculations. Factors have almost data-independent attributes with an exception being when factors are combined. In some cases it is not possible to rebuild attributes from the data alone.
You can add your own rebuild
method for an object not covered
by the methods here.
Value
An object similar to template
.