Vectorised over string and times.

str_dup(string, times)

Arguments

string

Input character vector.

times

Number of times to duplicate each string.

Value

A character vector.

Examples

fruit <- c("apple", "pear", "banana") str_dup(fruit, 2)
#> [1] "appleapple" "pearpear" "bananabanana"
str_dup(fruit, 1:3)
#> [1] "apple" "pearpear" "bananabananabanana"
str_c("ba", str_dup("na", 0:5))
#> [1] "ba" "bana" "banana" "bananana" "banananana" #> [6] "bananananana"