powered by

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

string

times

nstr(string, times)

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

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

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

Charles Dupont

paste, rep

paste

rep

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

Run the code above in your browser using DataLab