filter rows by missing values frequency
1
0
Entering edit mode
rgescudero • 0
@rgescudero-9337
Last seen 4.6 years ago

Does anybody has an R script to filter rows (genes) from a gene expression datamatrix, depending on the frequency of missing data along the samples? Let's say that I only want to analyze genes in a datamatrix having non-missing values in 90% of the samples.

Many thanks

Ramon

missing data filter • 1.1k views
ADD COMMENT
1
Entering edit mode
@james-w-macdonald-5106
Last seen 4 hours ago
United States

You don't need an R script, per se. Unless you call a one-liner a script. Assume you have a matrix called 'thematrix'.

thecount <- ceiling(ncol(thematrix) * 0.1)
filtered <- thematrix[rowSums(is.na(thematrix)) <= thecount,]
ADD COMMENT

Login before adding your answer.

Traffic: 684 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6