Skip to contents

Copy Attributes Between Two Objects

Usage

copyAttributes(x, y, attrNames)

Arguments

x

object to which to copy attributes of y

y

object from which to copy attributes to x

attrNames

vector of character containing the names of attributes in y to be copied to x

Examples

x <- structure(1, a = 2, b = 3)
y <- structure(2, c = 4)
copyAttributes(x, y, "c")
#> [1] 1
#> attr(,"a")
#> [1] 2
#> attr(,"b")
#> [1] 3
#> attr(,"c")
#> [1] 4