R/headts.r

Defines functions tailts headts

Documented in headts tailts

headts <- function(x, n = 5, ...) {
  if (n > dim(as.matrix(x))[1]) {
    return(x)
  } else {
    return(window(x, start = start(x), end = start(x) + c(0, n - 1), 
      frequency=tsp(x)[3]))
  }
}

tailts <- function(x, n = 5, ...) {
  if (n > dim(as.matrix(x))[1]) {
    return(x)
  } else {
    return(window(x, start = end(x) - c(0, n - 1), end = end(x), 
      frequency = tsp(x)[3]))
  }
}

Try the erer package in your browser

Any scripts or data that you put into this service are public.

erer documentation built on Sept. 26, 2024, 5:06 p.m.