On Wed, Nov 11, 2009 at 08:53:50AM -0800, William Dunlap wrote: > > Perhaps > > ave(x, rev(cumsum(rev(is.na(x)))), FUN=cumsum) > [1] 1 3 6 NA 5 11 18 26 35 45 > it takes some time to understand how it works, but it's perfect. thank you, stefan