Learn R Programming

riskRegression (version 2022.03.22)

colMultiply_cpp: Apply * by column

Description

Fast computation of sweep(X, MARGIN = 1, FUN = "*", STATS = scale)

Usage

colMultiply_cpp(X, scale)

Value

A matrix of same size as X.

Arguments

X

A matrix.

scale

a numeric vector of length equal to the number of rows of x

Author

Brice Ozenne <broz@sund.ku.dk>

Examples

Run this code
x <- matrix(1,6,5)
sweep(x, MARGIN = 1, FUN = "*", STATS = 1:6)
colMultiply_cpp(x, 1:6 )

Run the code above in your browser using DataLab