add {Acinonyx}R Documentation

Add (or delete) objects into (or from) an enclosing object

Description

add method adds objects into an enclosing object, delete removes objects from its parents. The exact semantics varies depending on the objects involved.

Usage

add(x, ...)
delete(x, ...)

## S3 method for class 'iPlot'
add(x, obj, ...)
## S3 method for class 'iContainer'
add(x, obj, ...)
## S3 method for class 'primitive'
add(x, obj, ...)
## Default S3 method:
add(x, obj, ...)

Arguments

x

target object

obj

object to be added into the target

...

further optional arguments

Details

The add method is defined in a very general way. The actual implementatations usually forward the dispatch to the second argument (at least the one listed here do) such that add methods can be defined for any combination of classes for the x and obj objects.

The use ranges from adding plots into containers, plot privitives to plots or even models to plots. The goal of this method (and its inverse remove) is to define the concept of adding or removing any kind of object or property that makes sense.

Value

The value is x modified to accomodate the addition of obj. Depending on the semantics it may be (and often is) x itself.

Note

The + and - operators are often dispatched to add and delete as a syntactic sugar for objects where such operation makes sense such that, for example, adding a model representation to a plot p can be done as p + lm(y ~ x).

(Also note that remove is a different non-generic function!)


[Package Acinonyx version 3.0-0 Index]