-
Notifications
You must be signed in to change notification settings - Fork 9
/
utils.r
37 lines (30 loc) · 1.04 KB
/
utils.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#' 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) }