Description Usage Arguments Details Value Note
add
method adds objects into an enclosing object, delete
removes objects from its parents. The exact semantics varies depending
on the objects involved.
1 2 3 4 5 6 7 8 9 10 11 |
x |
target object |
obj |
object to be added into the target |
... |
further optional arguments |
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.
The value is x
modified to accomodate the addition of
obj
. Depending on the semantics it may be (and often is) x
itself.
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!)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.