Thanks! na.locf was spot on
Very fast approach to this type of problem.
--
View this message in context:
http://r.789695.n4.nabble.com/Replacing-values-without-looping-tp3602247p3605203.html
Sent from the R help mailing list archive at Nabble.com.
__
Hi
> Hi,
>
> If you truly have an array, this is option that should be much faster
> than a loop:
>
> index <- which(is.na(dat))
> dat[index] <- dat[index - 1]
>
> the only catch is that when there previous value is NA, you may have
> to go through the process a few times to get them all. One
Hi,
If you truly have an array, this is option that should be much faster
than a loop:
index <- which(is.na(dat))
dat[index] <- dat[index - 1]
the only catch is that when there previous value is NA, you may have
to go through the process a few times to get them all. One way to
automate this wou
3 matches
Mail list logo