Version: 0.1.2
Date: 2020-08-24
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).
License: GPL-3
Language: en-US
Encoding: UTF-8
LazyData: true
ByteCompile: true
RoxygenNote: 7.1.1
LinkingTo: Rcpp
Imports: Rcpp
Suggests: spelling, data.table, testthat, covr
URL: https://github.com/privefl/inplace
BugReports: https://github.com/privefl/inplace/issues
NeedsCompilation: yes
Packaged: 2020-08-24 12:09:01 UTC; au639593
Author: Florian Privé [aut, cre]
Maintainer: Florian Privé <florian.prive.21@gmail.com>
Repository: CRAN
Date/Publication: 2020-08-24 13:50:02 UTC

inplace: 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).

Author(s)

Maintainer: Florian Privé florian.prive.21@gmail.com

See Also

Useful links:


In-place operators

Description

In-place operators

Usage

x %*<-% value

x %+<-% value

x %-<-% value

x %/<-% value

Arguments

x

Variable.

value

Value.

Value

NULL (invisibly).

Examples

mat <- matrix(1:4, 2)
mat
mat %+<-% 2
mat

Sweep

Description

Sweep

Usage

sweep1_in_place(x, STATS, FUN = c("-", "+", "*", "/"))

sweep2_in_place(x, STATS, FUN = c("-", "+", "*", "/"))

Arguments

x

a matrix.

STATS

the summary statistic which is to be swept out.

FUN

the function to be used to carry out the sweep.

Value

NULL, invisibly.

Examples

x <- matrix(1:6, 2)
sweep(x, 2, 1:3)
x
sweep2_in_place(x, 1:3)
x