Skip to contents

Replicates the rows of a data frame by a specified factor.

Usage

replicateRows(df, n)

Arguments

df

Data frame to replicate

n

Replication factor for each row

Value

Data frame with replicated rows

Examples

df <- data.frame(a = 1:3, b = letters[1:3])
replicateRows(df, 2)
#>   a b
#> 1 1 a
#> 2 1 a
#> 3 2 b
#> 4 2 b
#> 5 3 c
#> 6 3 c