Re: [R] if + is.na

2009-06-15 Thread Grześ
like: > > > > b[is.na(a)] = 43 > > > > might be helpful. This line would put a 43 in b in the corresponding > entry that was na in a. > > > > Good luck!. > > > > > >> Date: Sun, 14 Jun 2009 12:48:58 -0700 >> Fro

Re: [R] if + is.na

2009-06-14 Thread Jeremiah Rounds
g entry that was na in a. Good luck!. > Date: Sun, 14 Jun 2009 12:48:58 -0700 > From: gregori...@gmail.com > To: r-help@r-project.org > Subject: [R] if + is.na > > > Hello! > I wont to use a function is.na() > > I have two vectors: > > a=c(1,NA,3,3,3) &

Re: [R] if + is.na

2009-06-14 Thread Rolf Turner
On 15/06/2009, at 7:48 AM, Grześ wrote: Hello! I wont to use a function is.na() I have two vectors: a=c(1,NA,3,3,3) b=c(0,0,0,0,0) and when I use is.na function it's ok: is.na(a) [1] FALSE TRUE FALSE FALSE FALSE but I would create sth like this: for i in 1:length(a){ if (wsp[i] ==

Re: [R] if + is.na

2009-06-14 Thread Ben Bolker
Grześ wrote: > > Hello! > I wont to use a function is.na() > > I have two vectors: >> a=c(1,NA,3,3,3) >> b=c(0,0,0,0,0) > and when I use is.na function it's ok: >> is.na(a) > [1] FALSE TRUE FALSE FALSE FALSE > > but I would create sth like this: > > for i in 1:length(a){ > if (wsp[i]

[R] if + is.na

2009-06-14 Thread Grześ
Hello! I wont to use a function is.na() I have two vectors: > a=c(1,NA,3,3,3) > b=c(0,0,0,0,0) and when I use is.na function it's ok: > is.na(a) [1] FALSE TRUE FALSE FALSE FALSE but I would create sth like this: for i in 1:length(a){ if (wsp[i] == is.na(a)) {b=43} } or like this if(