Makes the fields and methods of an Object assignable via the
operator. This method is never called explicitly, but through an indirect
usage of the
$<- operator, e.g.
obj$name <- "foo".
1) This method will first search for a
set<Name>() method, e.g. if
name has the value
setAge() will be looked for.
If such a method exists it will be called with the Object as the first
value as the second, e.g.
set<Name>() is only looked for if
<name> is a non-private
field. A private field is a name beginning with a
The rational for this naming convention is to be consistent
ls() works, which will not list such members
Moreover, excluding private fields for the search of a
will decrease the overhead for such field.
2) If no such method exists the
value will be assigned to an
existing field named
name, if such exists.
3) Otherwise, the value will be assigned to a static field, if such exists.
4) In all other case, the value is assigned to a new field.
set<Name>() is called first, it is possible to
encapsulate (hide away) fields with certain names or to put
restrictions to what values can be assigned to them.
1 2 3 4
The name of the
The value to be assigned.
Returns itself, i.e.
this, as all
$<- methods must do.
For more information see
## Not run: For a complete example see help(Object).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.