R/check_mts_rows.R

Defines functions check_mts_rows

# This is a function to check if all MTS in the list have the same length

# Input parameters
# X: a list of MTS

#--------------------------------------------------------------------------------------

check_mts_rows <- function(X) {
  
  l <- length(X)
  n_rows <- unlist(lapply(X, nrow))
  max_rows <- max(n_rows)
  
  # All elements in the series must have the same number of rows
  
  if (sum(n_rows) != (max_rows * l)) {
    
    stop('All MTS must have the same length')
    
  }
  

  
  
}

Try the mlmts package in your browser

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

mlmts documentation built on Sept. 11, 2024, 6:41 p.m.