1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
#' @title Repeat and join a string
#'
#' @description
#' Repeats a string n times and joins the results.
#'
#' @param x [character]\cr
#' Vector of characters.
#' @param n [\code{integer(1)}]\cr
#' Times the vector \code{x} is repeated.
#' @param sep [\code{character(1)}]\cr
#' Separator to use to collapse the vector of characters.
#' @return \code{character(1)}.
#' @export
#' @examples
#' strrepeat("x", 3)
strrepeat = function(x, n, sep = "") {
paste0(rep.int(x, n), collapse = sep)
}
|