Re: [R] replacing NA for zero

2012-06-12 Thread Rui Barradas
=df3[idg,2]) df4 xy 1 1 0.00 2 2 0.12 3 3 0.25 4 4 0.11 5 5 0.00 6 6 0.16 7 7 0.20 8 8 0.00 A.K. - Original Message - From: Silvia Lucato To: r-help@r-project.org Cc: Sent: Tuesday, June 12, 2012 5:55 PM Subject: [R] replacing NA for zero Dear R users, I have a ve

Re: [R] replacing NA for zero

2012-06-12 Thread arun
rg Cc: Sent: Tuesday, June 12, 2012 5:55 PM Subject: [R] replacing NA for zero   Dear R users,   I have a very basic query, but was unable to find a proper anwser.   I have the following data.frame   x    y   2  0.12   3  0.25   4  0.11   6  0.16   7  0.20   and, due t

Re: [R] replacing NA for zero

2012-06-12 Thread arun
, June 12, 2012 5:55 PM Subject: [R] replacing NA for zero   Dear R users,   I have a very basic query, but was unable to find a proper anwser.   I have the following data.frame   x    y   2  0.12   3  0.25   4  0.11   6  0.16   7  0.20   and, due to further calcul

Re: [R] replacing NA for zero

2012-06-12 Thread Rolf Turner
A simplistic approach which works for the given example is as follows: Let your data frame be "X". Do: x <- 1:8 y <- numeric(8) y[X$x] <- X$y Y <- data.frame(x=x,y=y) Then "Y" is the desired result. cheers, Rolf Turner On 13/06/12 09:55, Silvia Lucato wrote: Dear R users,

Re: [R] replacing NA for zero

2012-06-12 Thread Helios de Rosario
> Dear R users, > > I have a very basic query, but was unable to find a proper anwser. > > I have the following data.frame > > x y > 2 0.12 > 3 0.25 > 4 0.11 > 6 0.16 > 7 0.20 > > and, due to further calculations, I need the data to be stored as > > x y > 1

[R] replacing NA for zero

2012-06-12 Thread Silvia Lucato
Dear R users, I have a very basic query, but was unable to find a proper anwser. I have the following data.frame x y 2 0.12 3 0.25 4 0.11 6 0.16 7 0.20 and, due to further calculations, I need the data to be stored as x y 1