Description Usage Arguments Details Value Examples
These functions provide three in-place modification operators for sequences
(where "sequence" means vector, list or pairlist), and two
Lisp/Scheme-friendly aliases for R's built-in assignment operator <-
.
1 2 3 4 5 6 7 8 9 10 11 |
nm |
The target symbol, whose value (a sequence, in the sense of a list, vector or pairlist) should be modified as appropriate and the symbol rebound. |
pos |
The index (into the target sequence) that set.pos should change. |
val |
The new value to assign to the target component of the target object. |
Three in-place modification operators are provided: set.pos
,
set.car
and set.cdr
, analogous to functions frequently found
in Lisp dialects. set.pos
modifies the element at a particular
positional index in a sequence, and set.car
is a special case of
set.pos
for pos = 1. set.cdr
modifies the subsequence that
excludes the first element.
These operators do "in-place" modification in the sense that they modify the binding of the symbol that is the first argument without the need for an explicit assignment statement.
The define
and set
functions are aliases for the built-in
<-
, and are traditional names for variable creation and assignment
operators in Scheme. sset
is also provided as an alias for
<<-
. Unlike in Scheme, there's no distinction in R between creating
a binding and assigning a value (equivalently, it's not possible to create
an unassigned variable), so define is equivalent to set here.
The new value.
1 2 3 4 5 6 7 8 9 10 11 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.