R/match_intervals_fun.R

Defines functions match_intervals

Documented in match_intervals

#' Matches the number of intervals between the two seasons selected
#'
#' @param list1 A list object that is the reference for `list2`
#' @param list2 A list object that the length of `list1` is being matched to
#'
#' @return The output is a list that has the same intervals as that in the
#' `list2` object.

#' @export
match_intervals <- function(list1, list2){
i1 <- sub("(.*)-\\d+-(.*)", "\\1-\\2",
          names(list1)) %in% sub("(.*)-\\d+-(.*)",
                                "\\1-\\2", names(list2))
list1 <- list1[i1]

}
jhnhng/trekR documentation built on April 25, 2022, 12:43 p.m.