Learn R Programming

cursory (version 1.0.0)

add_class: Add to object helpers

Description

These function make using pipe functions easier when altering an object.

Usage

add_class(x, new)

set_class(x, new)

add_comment(x, new)

set_comment(x, new)

Arguments

x

object to alter

new

new characteristic

Functions

  • set_class: Overwrite the class

  • add_comment: Add a comment

  • set_comment: Overwrite the comment

Examples

Run this code
# NOT RUN {
# set versions will replace anything already there.
a <- set_class(TRUE, 'example')
a <- set_comment(a, 'this is an example of setting a comment')

# Add version will add to `c()` anything there.
b <- add_class(a, 'ex123')
b <- add_comment(b, 'but you can also add more information')

class(a)
class(b)

comment(a)
comment(b)

# }

Run the code above in your browser using DataLab