[R] Data frame and function that requires vector as input

Gian Luca Negri negri.gl at gmail.com
Tue Mar 22 20:16:01 CET 2011


Hi,

I have a data.frame(zscores) that looks like this:

       gA     gB
g1  0.2    0.6
g2  0.3    Na

My problem is that I need to  use a function and the output is a vector 
of only the non NA values, so shorter than the list I would obtain 
dropping the data.frame.
What is the cleanest way to keep row and column names or putting the 
values back into the same data frame format?

The function is fdrtool() and I can compute the values I'm interested 
like this:
FDR=fdrtool([!is.na(zscores)])$qval
But at this point I don't know how to track back these values, to the 
original data frame

Thanks,
Gian Luca



More information about the R-help mailing list