split_matrix: Use Single Value Decomposition to split a matrix into two

Description Usage Arguments Value Examples

View source: R/svdtools.R

Description

Take a numerical matrix and return two same-sized matrices using exclude_components

Usage

1
split_matrix(mat, exclude)

Arguments

mat

A numeric matrix or a data frame coercible into a numeric matrix

exclude

A vector of integers specifying the components to exclude

Value

A named list with two matrices - remaining (inverse of excluded) and excluded (same as exclude_components)

Examples

1
2
3
4
5
6
7
8
## Not run: 
m<-matrix(rbinom(100,5,.1),ncol=10)
sm<-splitmatrix(m,2:4)
m2<-round(sm$remaining+sm$excluded)
m2<-apply(m2,c(1,2),as.integer)
identical(m,m2) # Should be TRUE

## End(Not run)

jimeharrisjr/svdtools documentation built on Jan. 7, 2021, 12:47 a.m.