Learn R Programming

Gmisc (version 3.0.3)

copyAllNewAttributes: 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())

Value

object The to argument object

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

Examples

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

Run the code above in your browser using DataLab