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.356114 0.482077 0.495351
#> [2,] 0.356114 0.482077 0.495351
#> [3,] 0.171207 0.060811 0.227599
#> [4,] 0.171207 0.060811 0.227599
#> [5,] 0.882102 0.628428 0.203744
#> [6,] 0.882102 0.628428 0.203744
#> [7,] 0.339898 0.363258 0.324949
#> [8,] 0.339898 0.363258 0.324949