Learn R Programming

riskRegression (version 2022.03.22)

sliceScale_cpp: Apply / by slice

Description

Fast computation of sweep(X, MARGIN = 1:2, FUN = "/", STATS = scale)

Usage

sliceScale_cpp(X, M)

sliceScalePointer_cpp(X, M)

Value

An array of same size as X.

Arguments

X

An array.

M

A matrix with the same number of row and columns as X.

Author

Brice Ozenne <broz@sund.ku.dk>

Examples

Run this code
x <- array(1, dim = c(2,6,5))
M <- matrix(1:12,2,6)
sweep(x, MARGIN = 1:2, FUN = "/", STATS = M)
sliceScale_cpp(x, M) 

Run the code above in your browser using DataLab