Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [,1] [,2]
- [1,] 1 2
- [2,] 3 4
- [3,] 5 6
- [,1] [,2] [,3] [,4] [,5] [,6]
- [1,] 1 1 1 2 2 2
- [2,] 3 3 3 4 4 4
- [3,] 5 5 5 6 6 6
- mat[,rep(seq_len(ncol(mat)), each=3)]
- # [,1] [,2] [,3] [,4] [,5] [,6]
- # [1,] 1 1 1 2 2 2
- # [2,] 3 3 3 4 4 4
- # [3,] 5 5 5 6 6 6
- (mat <- matrix(1:6, nrow=3, byrow = TRUE))
- # [,1] [,2]
- # [1,] 1 2
- # [2,] 3 4
- # [3,] 5 6
- k =3
- matrix(rep(mat, each = k), ncol = ncol(mat) * k, byrow = TRUE)
- # [,1] [,2] [,3] [,4] [,5] [,6]
- #[1,] 1 1 1 3 3 3
- #[2,] 5 5 5 2 2 2
- #[3,] 4 4 4 6 6 6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement