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.195319 0.195319 0.3544830 0.3544830 0.629989 0.629989
#> [2,] 0.700033 0.700033 0.0517403 0.0517403 0.267090 0.267090
#> [3,] 0.227827 0.227827 0.7173770 0.7173770 0.277801 0.277801
#> [4,] 0.865107 0.865107 0.6479612 0.6479612 0.317211 0.317211