cpp_rebuild: Low-level attribute re-constructor

View source: R/cpp11.R

cpp_rebuildR Documentation

Low-level attribute re-constructor

Description

Low-level attribute re-constructor

Usage

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

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.

Value

An object similar to source.

See Also

rebuild attrs_modify


cheapr documentation built on Nov. 28, 2025, 5:06 p.m.