Hi, c1 = (1,2,3,4,5,6,NA,7,8,NA,9,10,NA) library(zoo) na.locf(c1) # [1]? 1? 2? 3? 4? 5? 6? 6? 7? 8? 8? 9 10 10 A.K. Hi, I want to "fix" an array that contains several NA elements. And I would like to replace them with the previous valid element. So my array c = (1,2,3,4,5,6,NA,7,8,NA,9,10,NA) become cfixed= (1,2,3,4,5,6,6,7,8,8,9,10,10) (that's an example the actual array has thousands of elements) Thanks!