Hi z shifting: c(1,z[-length(z)]) then for N=1 tmp <- c(1,z[-length(z)])*z or c(1,z[-length(z)])&&z
length of the vector 1000000 (Indeed is more complicated because I need to use the result of all this with zoo time series) Typical N 10 to 400 typical number of zeros 10% I'll try all your new suggestions -- View this message in context: http://r.789695.n4.nabble.com/adding-zeroes-after-old-zeroes-in-a-vector-tp2534824p2535224.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.