R: Duplicate Strings

stri_dup {stringi} | R Documentation

## 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

### Details

Vectorized over `str` and `times`.

### Value

Returns a character vector of the same length as `str`.

### See Also

Other join: `stri_flatten`, `stri_join_list`, `stri_join`

### Examples

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

[Package stringi version 1.2.4 Index]