R/paste.R

Defines functions paste

Documented in paste

#' @title Backport of paste for R < 4.0.1
#' @rdname paste
#'
#' @description
#' See the original description in \code{base::paste}.
#'
#' @keywords internal
#' @rawNamespace if (getRversion() < "4.0.1") export(paste)
#' @examples
#' # get function from namespace instead of possibly getting
#' # implementation shipped with recent R versions:
#' bp_paste = getFromNamespace("paste", "backports")
#' bp_paste(letters[1:3], character(), collapse = NULL, recycle0 = TRUE)
paste <- function(..., sep = " ", collapse = NULL, recycle0 = FALSE) {
  if(recycle0 && any(lengths(list(...)) == 0L)) {
    base::paste(sep = sep, collapse = collapse) # for argument checking

    if (is.null(collapse)) character() else ""
  } else {
    base::paste(..., sep = sep, collapse = collapse)
  }
}

Try the backports package in your browser

Any scripts or data that you put into this service are public.

backports documentation built on June 24, 2024, 5:24 p.m.