with_attrs: Append or replace attributes of any object in a...

View source: R/functions.R

with_attrsR Documentation

Append or replace attributes of any object in a pipeline-frindly way.

Description

Append or replace attributes of any object in a pipeline-frindly way.

Usage

with_attrs(xx, rep.attrs = list(), app.attrs = list())

Arguments

xx

Object whose attributes to modify and then return the object

rep.attrs

Named list of attributes to create or replace

app.attrs

Named list of attributes to create or append to

Value

The object 'xx' with modified attributes

Examples

# Change an object's attribute
with_attrs(iris,list(class='list'))

# Create a new attribute for an object
foo <- with_attrs(LETTERS,list(comment='Hello world'))
comment(foo)
foo <- with_attrs(foo,rep='One more comment.')
comment(foo)


bokov/tidbits documentation built on Jan. 26, 2024, 6:25 p.m.