rm.attr: Remove (non-protected) attributes from an object

View source: R/rm.attr.R

rm.attrR Documentation

Remove (non-protected) attributes from an object

Description

rm.attr removes (non-protected) attributes from an object

Usage

rm.attr(
  object,
  list.levels = Inf,
  protected = c("class", "dim", "names", "dimnames", "rownames", "colnames")
)

Arguments

object

An object to operate on attributes from the object

list.levels

A non-negative integer specifying the number of levels of lists to apply the removal to

protected

A character vector containing the names of protected attributes (not to be removed)

Details

This function removes non-protected attributes from an R object. If the object is a list then the function will remove attributes within elements of the list down to the level specified by the list.levels input. (By default the function removes attributes from all levels of lists.) If you do not want to remove attributes from elements of a list (but still remove attributes from the outer level) you can set list.levels = 0 to do this..

Value

The object is returned with non-protected attributes removed

Examples

a <- structure(list(structure(1, x=2, names=3),
               list(0, structure(3, x=4, names=5))),
               x=3, names = 4)
str(rm.attr(a, 1))


utilities documentation built on July 1, 2022, 9:06 a.m.

Related to rm.attr in utilities...