w4m__nonzero_var: Support function to eliminate rows or columns that have zero...

Description Usage Arguments Value Examples

View source: R/ClassFilter.R

Description

(w4mclassfilter support function) Produce matrix from matrix xpre where all rows and columns having zero variance have been removed

Usage

1

Arguments

m

matrix: W4M data matrix potentially having rows or columns having zero variance

Value

matrix: input data matrix after removal of rows or columns having zero variance

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
m <- matrix(
  c(
    1, 2, 3, 4,
    3, 3, 3, 4,
    5, 7, 11, 4,
    13, 17, 19, 4
  )
, nrow = 4
, ncol = 4
, byrow = TRUE
)
rownames(m) <- c("A", "B", "C", "D")
colnames(m) <- c("W", "X", "Y", "Z")
expected <- matrix(
  c(
    1, 2, 3,
    5, 7, 11,
    13, 17, 19
  )
  , nrow = 3
  , ncol = 3
  , byrow = TRUE
)
rownames(expected) <- c("A", "C", "D")
colnames(expected) <- c("W", "X", "Y")
all.equal(w4m__nonzero_var(m), expected)

HegemanLab/w4mclassfilter documentation built on March 14, 2021, 1:19 a.m.