Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

nstr

Creates a string of arbitry length


Description

Creates a vector of strings which consists of the string segment given in each element of the string vector repeated times.

Usage

nstr(string, times)

Arguments

string

character: vector of string segments to be repeated. Will be recycled if argument times is longer.

times

integer: vector of number of times to repeat the corisponding segment. Will be recycled if argument string is longer.

Value

returns a character vector the same length as the longest of the two arguments.

Note

Will throw a warning if the length of the longer argment is not a even multiple of the shorter argument.

Author(s)

Charles Dupont

See Also

Examples

nstr(c("a"), c(0,3,4))

nstr(c("a", "b", "c"), c(1,2,3))

nstr(c("a", "b", "c"), 4)

Hmisc

Harrell Miscellaneous

v4.5-0
GPL (>= 2)
Authors
Frank E Harrell Jr <fh@fharrell.com>, with contributions from Charles Dupont and many others.
Initial release
2021-02-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.