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

rep_cols(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_cols(test_matrix, 2)
#>           [,1]      [,2]       [,3]       [,4]     [,5]     [,6]
#> [1,] 0.0988091 0.0988091 0.72271880 0.72271880 0.555412 0.555412
#> [2,] 0.8765333 0.8765333 0.00598996 0.00598996 0.567463 0.567463
#> [3,] 0.1780550 0.1780550 0.52680599 0.52680599 0.701044 0.701044
#> [4,] 0.3976051 0.3976051 0.67365622 0.67365622 0.907056 0.907056