remove: Data Cleaning

Description Usage Arguments Author(s) See Also Examples

Description

Removes empty row/column or row/column with missing/ infinite values or zeros.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
remove_NA(x, ...)

remove_Inf(x, ...)

remove_empty(x, ...)

remove_zero(x, ...)

## S4 method for signature 'matrix'
remove_NA(x, margin = 1)

## S4 method for signature 'matrix'
remove_Inf(x, margin = 1)

## S4 method for signature 'matrix'
remove_zero(x, margin = 1)

## S4 method for signature 'matrix'
remove_empty(x, margin = 1)

Arguments

x

A matrix, a data.frame or a *Matrix object.

...

Currently not used.

margin

An integer giving the subscript which the cleaning will be applied over (1 indicates rows, 2 indicates columns).

Author(s)

N. Frerebeau

See Also

Other utilities: replace()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Create a count data matrix
X <- CountMatrix(sample(1:10, 25, TRUE), nrow = 5, ncol = 5)
k <- sample(1:25, 3, FALSE)

## Add zeros
X[k] <- 0L
## Remove row with zeros
remove_zero(X, margin = 1)
## Remove column with zeros
remove_zero(X, margin = 2)

## Add NA
X[k] <- NA
## Remove row with zeros
remove_NA(X, margin = 1)
## Remove column with zeros
remove_NA(X, margin = 2)

arkhe documentation built on Sept. 18, 2021, 5:07 p.m.