Learn R Programming

do (version 2.0.0.1)

replicate: Replicate Each Elements of Vectors

Description

Replicate Each Elements of Vectors

Usage

rep_n(x, each)

rep_character(x, each)

Value

replicated vectors

Arguments

x

vectors

each

one or more numbers for replication

Examples

Run this code
rep_n(c('ab','cde','k','op'),5)
rep_n(c('ab','cde','k','op'),c(4,6))
rep_n(c('ab','cde','k','op'),c(1,2,3,4))

rep_character(c('ab','cde','k','op'),5)
rep_character(c('ab','cde','k','op'),c(4,6))
rep_character(c('ab','cde','k','op'),c(1,2,3,4))

Run the code above in your browser using DataLab