format_array <- function()

in R/adlib.R [327:338]


format_array <- function(items) {
  if (is.numeric(items)) {
    out <- paste0("[", paste0(items, collapse = ","), "]")
  } else if (is.character(items)) {
    out <- paste0("[", paste0(shQuote(items, type = "sh"), collapse = ","), "]")
  }
  else {
    dtype <- class(items)
    stop(glue::glue("Don't know how to format array of class {dtype}", dtype = dtype))
  }
  return(out)
}