I have a suggestion for kernapply for ts objects. When we choose the 
option circular=F, the returned series don't have the correct dates. The 
removed dates are all at the beginning instead of half at the beginning 
and half at the end. It is particularly useful when we need to smooth 
the series (or remove a trend using a filter) before estimating a model 
(like in macroeconomics) or simply to plot the  original series with the 
smoothed one. Of course, there is always the option of doing it by hand 
of the use circular=T and trim the series but I thought it would be 
nicer that way.

Here is my suggestion (maybe not the nicest way to do it but it works)


kernapply.ts <- function (x, k, circular = FALSE, ...)
{
     if (!is.matrix(x))
     {
         y <- kernapply.vector(as.vector(x), k, circular=circular)
         ts (y, end=end(x), frequency=frequency(x))
     }
     else
         y <- apply(x, MARGIN=2L, FUN=kernapply, k, circular=circular)

     if(circular)
         ts (y, end=end(x), frequency=frequency(x))
     else
     {
     y <- as.ts(y)
         t1 <- tsp(x)[1]+(length(k[[1]])-1)/tsp(x)[3]
         t2 <- tsp(x)[2]-(length(k[[1]])-1)/tsp(x)[3]
         tsp(y) <- c(t1,t2,tsp(x)[3])
         return(y)
     }
}

-- 
*Pierre Chaussé*
Assistant Professor
Department of Economics
University of Waterloo

	[[alternative HTML version deleted]]

