R/blanks.R

Defines functions blanks

Documented in blanks

#' @title Blanks
#' @description Create character vector of blanks
#' @details This function emulates the behavior of a homonimous function from
#' Matlab
#' @param n length of vector
#' @author Waldir Leoncio
#' @return Vector of n blanks
#' @export
#' @examples
#' blanks(1)
#' blanks(3)
blanks <- function(n) {
  if (n < 0) {
    warning("Negative n passed. Treating as n = 0")
    n <- 0
  }
  paste(rep(" ", n), collapse = "")
}

Try the matlab2r package in your browser

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

matlab2r documentation built on Feb. 16, 2023, 10:39 p.m.