DescTools (version 0.99.19)

StrRep: Repeat the Elements of a Character Vector

Description

Repeat the character strings in a character vector a given number of times (i.e., concatenate the respective numbers of copies of the strings).

Usage

StrRep(x, times, sep = "")

Arguments

x
a character vector, or an object which can be coerced to a character vector using as.character.

times
an integer vector giving the (non-negative) numbers of times to repeat the respective elements of x.

sep
a character string to separate the terms. Not NA_character_.

Value

Details

The elements of x and times will be recycled as necessary (if one has no elements, and empty character vector is returned). Missing elements in x or times result in missing elements of the return value.

See Also

strrep

Examples

Run this code
StrRep(x="wiki", times=1:3, sep=c("", "-"))

Run the code above in your browser using DataLab