Learn R Programming

ribiosUtils (version 1.7.7)

removeColumnsByFunc: Remove rows or column by function

Description

Remove rows or column by function

Usage

removeColumnsByFunc(matrix, removeFunc)

removeRowsByFunc(matrix, removeFunc)

Value

A matrix with rows or columns whose return value of removeFunc

is TRUE

Arguments

matrix

A matrix

removeFunc

A function which should return boolean results

Examples

Run this code
myMat <- matrix(c(1, 3 ,5, 4, 5, 6, 7, 9, 11), byrow=FALSE, nrow=3)
removeColumnsByFunc(myMat, removeFunc=function(x) any(x %% 2 == 0))
removeRowsByFunc(myMat, removeFunc=function(x) any(x %% 2 == 0))

Run the code above in your browser using DataLab