copyAllNewAttributes: A simple thing to keep the attributes

View source: R/copyAllNewAttributes.R

copyAllNewAttributesR Documentation

A simple thing to keep the attributes

Description

Skips the attributes that the to object already has to avoid overwriting dim and other important attributes

Usage

copyAllNewAttributes(from, to, attr2skip = c(), attr2force = c())

Arguments

from

The from object

to

The to object

attr2skip

An optional lists of attributes that you may want to avoid having copied

attr2force

An optional lists of attributes that you may want to force copy even if they already exist in the new object

Value

object The to argument object

Examples

a <- "test"
attr(a, 'wow') <- 1000
b <- a
b <- copyAllNewAttributes(a, b)
print(attr(b, 'wow'))


Gmisc documentation built on Aug. 26, 2023, 1:07 a.m.