Learn R Programming

oops (version 0.2.0)

Extract: Extract or Replace Parts of a Class or Instance

Description

Operators acting on oClass generators and their instances.

Usage

# S3 method for ClassGenerator
$(x, name)

# S3 method for ClassGenerator [[(x, i, exact = TRUE, inherits = TRUE)

# S3 method for ClassGenerator $(x, name) <- value

# S3 method for ClassGenerator [[(x, name) <- value

# S3 method for Instance $(x, name)

# S3 method for Instance [[(x, i, exact = TRUE, inherits = TRUE)

Arguments

x

object of class "Instance" or "ClassGenerator"

i, name

character or symbol for `$` describing field name to return or set

exact

logical controlling whether a partial match is acceptable. Defaults to TRUE for no partial matching

inherits

logical describing whether parent environments should be searched

value

new field value

Value

Environment of class "Instance" or function of class "ClassGenerator"

Details

For oClass instances, `$` and `[` first search the instance environment for the object. If no object is found, then all inherited objects are searched in order. Any object assigned to the instance will be inserted into the instance's environment. These operators act on the underlying Class template environment when applied to a Class generator.