Repeats each row in the matrix or data frame 'x' a number of times equal to 'times'.
rep_rows(x, times)
A matrix or data frame
An integer indicating the number of times to repeat the row/column
A matrix or data.frame depending on type of the input
test_matrix <- matrix(runif(12), 4)
rep_rows(test_matrix, 2)
#> [,1] [,2] [,3]
#> [1,] 0.501739 0.670834 0.758093
#> [2,] 0.501739 0.670834 0.758093
#> [3,] 0.718605 0.113109 0.769681
#> [4,] 0.718605 0.113109 0.769681
#> [5,] 0.508818 0.253357 0.648407
#> [6,] 0.508818 0.253357 0.648407
#> [7,] 0.127047 0.517846 0.616284
#> [8,] 0.127047 0.517846 0.616284