| 1 |
# for R versions < 4.0 |
| 2 |
|
| 3 |
# ignore the perl argument for regexec() if it's not supported (in R < 3.3); we |
| 4 |
# use perl = TRUE only for speed in crack() |
| 5 |
if (!'perl' %in% names(formals(regexec))) |
| 6 |
regexec = function(..., perl) base::regexec(...) |
| 7 |
|
| 8 |
has_fun = function(name, envir = baseenv()) exists(name, envir, inherits = FALSE) |
| 9 |
|
| 10 |
if (!has_fun('isFALSE')) isFALSE = function(x) { |
| 11 |
is.logical(x) && length(x) == 1 && !is.na(x) && !x |
| 12 |
} |
| 13 |
if (!has_fun('startsWith')) startsWith = function(...) xfun:::startsWith(...) |
| 14 |
if (!has_fun('endsWith')) endsWith = function(...) xfun:::endsWith(...) |
| 15 |
if (!has_fun('strrep')) strrep = function(...) xfun:::strrep(...) |