R/subset.RepoTimeInt.R

#' @title Extract parts of an object of class \linkS4class{RepoTimeInt}
#' 
#' @description \code{[} extracts parts of an object of class 
#' \linkS4class{RepoTimeInt}. 
#' 
#' @param x Object of class \linkS4class{RepoTimeInt} from which to extract 
#' parts.
#'
#' @param i,j,... indices corresponding to the elements to extract. 
#'       
#' @param drop Included for coherence.
#'
#' @return Object of class \linkS4class{RepoTimeInt}.
#'  
#' @examples
#' Ejemplo <- newRepoTime(paste0('MM', c('03', '04'), '2014'))
#' Ejemplo[1]
#' Ejemplo['MM032014']
#' 
#' @include RepoTimeInt-class.R newRepoTime.R
#' 
#' @export
setMethod(
  f = "[",
  signature = c("RepoTimeInt"),
  function(x, i, j, ..., drop = TRUE){
    
    mc <- match.call()
    newx <- getRepo(object = x)
    names(newx) <- newx
    mc[['x']] <- newx
    output <- eval(expr = mc, envir = parent.frame())
    output <- newRepoTime(Time = output)
    return(eval = output)
    
  }
)
david-salgado/RepoTime documentation built on Feb. 2, 2024, 2:07 p.m.