Repeats each row in the matrix or data frame 'x' a number of times equal to 'times'.

rep_rows(x, times)

Arguments

x

A matrix or data frame

times

An integer indicating the number of times to repeat the row/column

Examples

test_matrix <- matrix(runif(12), 4)
rep_rows(test_matrix, 2)
#>          [,1]     [,2]      [,3]
#> [1,] 0.721889 0.293587 0.4661458
#> [2,] 0.721889 0.293587 0.4661458
#> [3,] 0.922547 0.601517 0.0145673
#> [4,] 0.922547 0.601517 0.0145673
#> [5,] 0.615395 0.883641 0.0018020
#> [6,] 0.615395 0.883641 0.0018020
#> [7,] 0.616229 0.620969 0.7028650
#> [8,] 0.616229 0.620969 0.7028650