R/shift.r

Defines functions shift

shift <- function(x, n) {
  if(n == 0) 
   x
  else if(n < 0)
   c( rep(NA,-n), x[ seq(1, length(x)+n) ] )
  else
   c( x[-(1:n)], rep(NA,n) )
}
HervePerdry/covid19.SPF documentation built on Jan. 30, 2022, 7:22 p.m.