Question: filter rows by missing values frequency
0
gravatar for rgescudero
3.3 years ago by
rgescudero0
rgescudero0 wrote:

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

filter missing data • 454 views
ADD COMMENTlink modified 3.3 years ago by James W. MacDonald49k • written 3.3 years ago by rgescudero0
Answer: filter rows by missing values frequency
1
gravatar for James W. MacDonald
3.3 years ago by
United States
James W. MacDonald49k wrote:

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 COMMENTlink written 3.3 years ago by James W. MacDonald49k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 480 users visited in the last hour