R/lagpad.R

Defines functions lagpad

Documented in lagpad

#' Function to get a vector lagged.
#'
#' @param x numeric vector to be lagged.
#' @param k number of lags to be applied.
#' @return A lagged vector.
#' @export
lagpad <- function(x, k) {
  res <- c(rep(NA, k), x)[1:length(x)]
  return(res)
}

Try the collin package in your browser

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

collin documentation built on Sept. 19, 2023, 5:06 p.m.