R/utils.r

Defines functions is_memento is_first_memento is_next_memento is_prev_memento is_last_memento is_original is_timemap is_timegate

Documented in is_first_memento is_last_memento is_memento is_next_memento is_original is_prev_memento is_timegate is_timemap

#' Various helper tests for memento `rel` values
#'
#' Very useful in a `purrr` or `data_frame` context.
#'
#' @md
#' @param x character vector (ideally from a `rel` `memento` `data_frame` column)
#' @return `logical` vector
#' @export
is_memento <- function(x) { grepl("memento", x, ignore.case=TRUE) }

#' @rdname is_memento
#' @export
is_first_memento <- function(x) { grepl("first memento", x, ignore.case=TRUE) }

#' @rdname is_memento
#' @export
is_next_memento <- function(x) { grepl("next memento", x, ignore.case=TRUE) }

#' @rdname is_memento
#' @export
is_prev_memento <- function(x) { grepl("prev memento", x, ignore.case=TRUE) }

#' @rdname is_memento
#' @export
is_last_memento <- function(x) { grepl("last memento", x, ignore.case=TRUE) }

#' @rdname is_memento
#' @export
is_original <- function(x) { grepl("original", x, ignore.case=TRUE) }

#' @rdname is_memento
#' @export
is_timemap <- function(x) { grepl("timemap", x, ignore.case=TRUE) }

#' @rdname is_memento
#' @export
is_timegate <- function(x) { grepl("timegate", x, ignore.case=TRUE) }
hrbrmstr/wayback documentation built on May 17, 2019, 5:53 p.m.