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

1
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

1
2
3
4
5
a <- "test"
attr(a, 'wow') <- 1000
b <- a
b <- copyAllNewAttributes(a, b)
print(attr(b, 'wow'))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.