swap_cc: Swaps values in each row

Description Usage Arguments Value See Also Examples

View source: R/RcppExports.R

Description

This function swaps the values in each row of a matrix by permuting the columns via the indices provided in the index matrix. All swapElements()-methods use this function internally. The code is extended to C++ using the packages Rcpp and RcppArmadillo.

Usage

1
swap_cc(values, index)

Arguments

values

A matrix containing the values to be swapped.

index

An integer matrix defining how values should be swapped.

Value

A matrix with swapped values.

See Also

Examples

1
2
3
values <- matrix(rnorm(10), ncol = 2)
index <- matrix(c(2,1), nrow = 5, ncol = 2)
swap_cc(values, index)

simonsays1980/finmix documentation built on Dec. 23, 2021, 2:25 a.m.