Title: | In-place Operators for R |
---|---|
Description: | It provides in-place operators for R that are equivalent to '+=', '-=', '*=', '/=' in C++. Those can be applied on integer|double vectors|matrices. You have also access to sweep operations (in-place). |
Authors: | Florian Privé [aut, cre] |
Maintainer: | Florian Privé <[email protected]> |
License: | GPL-3 |
Version: | 0.1.2 |
Built: | 2024-10-31 04:04:57 UTC |
Source: | https://github.com/privefl/inplace |
In-place operators
x %*<-% value x %+<-% value x %-<-% value x %/<-% value
x %*<-% value x %+<-% value x %-<-% value x %/<-% value
x |
Variable. |
value |
Value. |
NULL
(invisibly).
mat <- matrix(1:4, 2) mat mat %+<-% 2 mat
mat <- matrix(1:4, 2) mat mat %+<-% 2 mat
Sweep
sweep1_in_place(x, STATS, FUN = c("-", "+", "*", "/")) sweep2_in_place(x, STATS, FUN = c("-", "+", "*", "/"))
sweep1_in_place(x, STATS, FUN = c("-", "+", "*", "/")) sweep2_in_place(x, STATS, FUN = c("-", "+", "*", "/"))
x |
a matrix. |
STATS |
the summary statistic which is to be swept out. |
FUN |
the function to be used to carry out the sweep. |
NULL
, invisibly.
x <- matrix(1:6, 2) sweep(x, 2, 1:3) x sweep2_in_place(x, 1:3) x
x <- matrix(1:6, 2) sweep(x, 2, 1:3) x sweep2_in_place(x, 1:3) x