Learn R Programming

stringi (version 1.1.3)

stri_dup: Duplicate Strings

Description

Duplicates each string times times and concatenates the results.

Usage

stri_dup(str, times)

Arguments

str
a character vector of strings to be duplicated
times
an integer vector with the numbers of times to duplicate each string

Value

Returns a character vector of the same length as str.

Details

Vectorized over str and times.

See Also

Other join: stri_flatten, stri_join_list, stri_join

Examples

Run this code
stri_dup("a", 1:5)
stri_dup(c("a", NA, "ba"), 4)
stri_dup(c("abc", "pqrst"), c(4, 2))

Run the code above in your browser using DataLab