Repeats each column of the matrix or data frame 'x' a number of times equal to 'times'.
rep_cols(x, times)
A matrix or data.frame depending on the type of the input
test_matrix <- matrix(runif(12), 4)
rep_cols(test_matrix, 2)
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] 0.0807501 0.0807501 0.00739944 0.00739944 0.732882 0.732882
#> [2,] 0.8343330 0.8343330 0.46639350 0.46639350 0.772522 0.772522
#> [3,] 0.6007609 0.6007609 0.49777739 0.49777739 0.874601 0.874601
#> [4,] 0.1572084 0.1572084 0.28976724 0.28976724 0.174941 0.174941