Re: [R] _: how to replace values in x by means in subgroups created in ...(not loops)

2011-07-28 Thread Eugeniusz Kałuża
t;result <- merge(dataset, tmp) >result$Mean[is.na(result$y) | result$y != 0] <- result$x[is.na(result$y) | >result$y != 0] > >Best regards, > >Thierry >> -----Oorspronkelijk bericht- >> Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]

Re: [R] how to replace values in x by means in subgroups created in ... (not loops)

2011-07-27 Thread ONKELINX, Thierry
:21 > Aan: r-help@r-project.org > Onderwerp: [R] how to replace values in x by means in subgroups created in ... > (not loops) > > > # Dear all, > # how to replace values in x by means in subgroups created in ... > # replace only these values where y=0 in continous sequence #

[R] how to replace values in x by means in subgroups created in ... (not loops)

2011-07-27 Thread Eugeniusz Kałuża
# Dear all, # how to replace values in x by means in subgroups created in ... # replace only these values where y=0 in continous sequence # replace by mean calculated locally for each subgroup created by # continous sequence of 0,0,0 in parallel y vector, i.e. # where there is continous sequence