R/hy_paste_names.R

Defines functions .paste_names

.paste_names <- function(...) {
  if (nargs() == 1L & is.list(..1)) {
    dots <- ..1
  } else {
    dots <- list(...)
  }

  names <- names(dots)
  names <- sapply(
    names,
    function(x) {
      if (nchar(x) > 0L) {
        sprintf("%s = ", x)
      } else {
        ""
      }
    }
  )

  paste(names, dots, collapse = ", ", sep = "")
}
r-hyperspec/hyperSpec documentation built on May 31, 2024, 5:53 p.m.