File: utils.R

package info (click to toggle)
r-cran-cli 3.6.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,300 kB
  • sloc: ansic: 16,412; cpp: 37; sh: 13; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 526 bytes parent folder | download | duplicates (3)
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

is_yes <- function(x) {
  tolower(x) %in% c("true", "yes", "y", "t", "1")
}

format_iso_8601 <- function(p) {
  format(p, "%Y-%m-%dT%H:%M:%S+00:00")
}

has_packages <- function(pkgs) {
  all(vapply(pkgs, requireNamespace, logical(1), quietly = TRUE))
}

cli_escape <- function(x) {
  x <- gsub("{", "{{", x, fixed = TRUE)
  x <- gsub("}", "}}", x, fixed = TRUE)
  x
}

# missing from older R

isFALSE <- function (x) {
  is.logical(x) && length(x) == 1L && !is.na(x) && !x
}

get_ppid <- function() {
  .Call(clic_getppid)
}