Learn R Programming

arkhe (version 0.3.1)

replace: Data Replacement

Description

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

Usage

replace_NA(x, ...)

# S4 method for matrix replace_NA(x, value = 0)

Arguments

x

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

...

Currently not used.

value

A possible value to replace missing values of x.

See Also

Other utilities: remove()

Examples

Run this code
# NOT RUN {
## 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)
# }

Run the code above in your browser using DataLab