Skip to content

Commit

Permalink
Remove obsolete backports (#1882)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico committed Nov 29, 2023
1 parent 3400834 commit 11b62e0
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,12 @@ escape_regex <- function(x) {
gsub(paste0("([\\", paste0(collapse = "\\", chars), "])"), "\\\\\\1", x, perl = TRUE)
}

# For R 3.1
dir.exists <- function(paths) {
file.exists(paths) & file.info(paths)$isdir
}

maybe_restart <- function(restart) {
if (!is.null(findRestart(restart))) {
invokeRestart(restart)
}
}

# Backport for R 3.2
strrep <- function(x, times) {
x = as.character(x)
if (length(x) == 0L)
return(x)
unlist(.mapply(function(x, times) {
if (is.na(x) || is.na(times))
return(NA_character_)
if (times <= 0L)
return("")
paste0(replicate(times, x), collapse = "")
}, list(x = x, times = times), MoreArgs = list()), use.names = FALSE)
}

# Backport for R < 4.0
deparse1 <- function(expr, ...) paste(deparse(expr, ...), collapse = "\n")

Expand Down

0 comments on commit 11b62e0

Please sign in to comment.