Learn R Programming

CountClust (version 1.0.2)

RemoveSparseFeatures: Removes features with a lot of 0 counts

Description

This function deals with zero counts in the counts dataset. If for a feature, the proportion of zeros across the samples is greater than filter_prop, then we remove the feature.

Usage

RemoveSparseFeatures(data, filter_prop = 0.9)

Arguments

data
count data in a sample by feature matrix.
filter_prop
threshold proportion. If the proportion of zeros for the feature exceeds this threshold then we remove the feature altogether. Default is 0.9.

Value

Returns a list with
data
filtered data with sparse features removed
sparse_features
the feature names of the features found sparse and removed

Examples

Run this code
mat <- rbind(c(2,0,3,0,4),c(4,5,5,0,0),c(30,34,63,25,0),c(0,0,0,0,0));
RemoveSparseFeatures(mat, filter_prop = 0.5)
RemoveSparseFeatures(mat)

Run the code above in your browser using DataLab