Learn R Programming

cheapr (version 1.4.0)

cpp_rebuild: Low-level attribute re-constructor

Description

Low-level attribute re-constructor

Usage

cpp_rebuild(target, source, target_attr_names, source_attr_names, shallow_copy)

Value

An object similar to source.

Arguments

target

Target object you wish to rebuild attributes on.

source

Source object to copy attributes from.

target_attr_names

[character(n)] Names of target attributes to keep.

source_attr_names

[character(n)] Names of source attributes to copy onto target.

shallow_copy

[logical(1)] Should target be shallow copied before re-building? If FALSE attributes are added in-place.

Details

cpp_rebuild() is mostly a convenience function to help with choosing exactly which attributes to copy onto the target object. rebuild() is a related generic function with rebuild methods for common objects (currently only tbl_df, data.frame and data.table). For examples of further rebuild methods, see the fastplyr package.

To modify attributes yourself you can of course use base R attribute functions like attr() and attributes() or cheapr's more convenient attrs_modify.

See Also

rebuild attrs_modify