R: Remove Attributes from an Object

StripAttr {DescTools} | R Documentation

## Remove Attributes from an Object

### Description

For convenience we sometimes want to strip some or all attributes in a oneliner.

### Usage

    StripAttr(x, attr_names = NULL)

### Arguments

`x` | the object whose attributes should be removed.
`attr_names` | a vector with attribute names, which will be removed. Leaving the default to `NULL` will cause all the attributes to be deleted.

### Value

the object `x` without the attributes contained in attr_names

### Author(s)

Andri Signorell <andri@signorell.net>

### See Also

`SetNames`, `unname`

### Examples

    x <- runif(10)
    attr(x, "some_attr") <- "First attribute"
    attr(x, "other_attr") <- "Second attribute"

    # strip all attributes
    StripAttr(x)

    # only some
    StripAttr(x, "other_attr")

[Package DescTools version 0.99.38 Index]