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

2011-03-23 Thread Greg Snow
If a is a vector with missing values and b is the result of the function call that has just the non-missing computations on a, then you can do something like: newdat - rep(NA, length(a)) newdat[ !is.na(a) ] - b Sometimes the which and match functions can be useful as well. -- Gregory (Greg)

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

2011-03-23 Thread David Winsemius
On Mar 22, 2011, at 3:16 PM, Gian Luca Negri wrote: Hi, I have a data.frame(zscores) that looks like this: gA gB g1 0.20.6 g2 0.3Na I hope it doesn't look likethat because it would mean you had gB as a character vector when I think you want that value to be NA.

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

2011-03-22 Thread Gian Luca Negri
Hi, I have a data.frame(zscores) that looks like this: gA gB g1 0.20.6 g2 0.3Na 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