Learn R Programming

oops (version 0.2.0)

add_fields: Add Fields to oClasses and Other Objects

Description

For environments, oClass instances and generator, add_fields is a wrapper for list2env; it adds the objects in ... the environment if they are named. For list and other objects, it behaves similar to appending ... as a list.

Usage

add_fields(x, ...)

Arguments

x

oClass instance, generator, environment, list, or other object

...

named objects to be added to x

Value

object of same type as x or list

Examples

Run this code
# NOT RUN {
clown <- oClass("clown")
add_fields(clown, laugh = "haha", is_funny=TRUE)

clown$laugh

# }

Run the code above in your browser using DataLab