R/timedom.trunc.R

Defines functions timedom.trunc

Documented in timedom.trunc

#' This function removes lags from a linear filter.
#'
#' @title Choose lags of an object of class \code{timedom}
#' @param A an object of class \code{timedom}.
#' @param lags a vector which contains a set of lags. These lags must be a subset of the lags defined for timedom object A. Only those lags will be kept, the other lags are removed.
#' @return An object of class \code{timedom}.
#' @keywords time.domain
#' @export
timedom.trunc = function(A, lags){
  if (!is.timedom(A))
    stop ("A must be an object of class timedom")
   suboperators=A$operators[,,A$lags %in% lags,drop=FALSE]
   #drop=False guarantees that filter of length one is not converted from array to matrix
   timedom(suboperators,lags=as.vector(intersect(lags,A$lags)))
  }

Try the freqdom package in your browser

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

freqdom documentation built on Oct. 4, 2022, 5:05 p.m.