2_constructor_utilities: Constructor Utilities

Description Usage Arguments Details Examples

Description

Functions for constructing named lists and S3 objects.

Usage

1
2
LIST (...)
EXTEND (object, class, ...)

Arguments

object

An object.

class

String, giving the class name.
Can be a character vector, in which case, subclasses precede superclasses.
Also, can be NULL or missing.

...

A list of name=value pairs, or objects.

Details

The LIST function constructs/returns a named list, automatically naming it's elements, if names aren't supplied.

The EXTEND function constructs/returns an S3 object, by prepending the (optional) new class to the existing classes, and then assigning attributes.

Note that it's possible to combine the with/EXTEND functions, to take attribute values from a named list.

Examples

1
2
3
4
5
object <- x <- y <- z <- 1

LIST (x, y, z=0, k=z)

EXTEND (object, "something", x, y, z=0, k=z)

intoo documentation built on March 13, 2020, 1:45 a.m.