Description Usage Arguments Details Value Note Author(s) See Also Examples
The generic swap
combines x[i]
and x[i] <- value
in a single operation.
1 2 3 4 5 6 7 |
x |
a ff or ram object |
value |
the new values to write, possibly recycled, see |
i |
index information, see |
... |
missing OR up to length(dim(x)) index expressions OR (ff only) |
drop |
logical scalar indicating whether array dimensions shall be dropped |
bydim |
how to interpret vector to array data, see |
add |
TRUE if the values should rather increment than overwrite at the target positions, see |
pack |
FALSE to prevent rle-packing in hybrid index preprocessing, see |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
Values at the target positions.
More precisely swap(x, value, i, add=FALSE)
returns the old values at the position i
while swap(x, value, i, add=TRUE)
returns the incremented values of x
.
Note that swap.default
changes the object in its parent frame and thus violates R's usual functional programming logic.
When using add=TRUE
, duplicated index positions should be avoided, because ff and ram objects behave differently:
1 2 3 4 5 |
Jens Oehlschlägel
[.ff
, add
, readwrite.ff
, getset.ff
, LimWarn
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.