On 6/7/05, Omar Lakkis <uofiowa at gmail.com> wrote: > tmp <- c(-1,NA,NA,1,1,NA,NA,1) > > without using a loop, how can I replace all NAs in the list above with > the previous none NA value in the list? This is known as last occurrence carried forward (LOCF) and is implemented in both the 'zoo' and 'its' packages, e.g. library(zoo) na.locf(tmp)