Rebuild an object from a template
rebuild(x, template, ...)# S3 method for data.frame
rebuild(x, template, shallow_copy = TRUE, ...)
# S3 method for data.table
rebuild(x, template, shallow_copy = TRUE, ...)
An object similar to template
.
An object in which carefully selected attributes
will be copied into from template
.
A template object used to copy attributes into x
.
Further arguments passed onto methods.
Should x
be shallow copied before rebuilding?
Default is TRUE
.
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.