[R] how to get a row with its its p value below 0.01 ??
rolf.turner at xtra.co.nz
Wed Sep 14 08:40:05 CEST 2011
On 14/09/11 17:49, anand m t wrote:
> Hi all,
> I'm analyzing micro array data.. it has produced a file (to be specific
> matrix) withdimension of 35556 2.
> first few lines of the matrix are as below..
> probe_name control.fdr.pvals.present
> 10338001 0.000440001
> 10338002 0.000583093
> 10338003 0.000528449
> 10338004 0.000610362
> 10338005 0.000151825
> 10338006 0.0001733
> 10338007 0.000152924
> Now, i want only rows whose "control.fdr.pvals.present" values are below
> How do i that?? Please help me soon...
Your question indicates that your knowledge of R is very limited.
If you are going to analyze micro array data in R, it behoves you
to learn some R. Read, mark, and inwardly digest ``An Introduction
to R'' (under "Manuals" on the R web page, www.r-project.org).
At the very least.
To answer your question: If your matrix is named "m" then
m[m[,2] <= 0.01,]
gives you what you want. Possibly more perspicuously:
ind <- m[,2] <= 0.01 # ind is a logical vector of length = nrow(m)
m[ind,] # This selects those rows of m where ind is TRUE
More information about the R-help