Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- v1 = c(1,3,2,4,1)
- v2 = c(2,2,2,2,2)
- dados = matrix(c(v1,v2),ncol = 2)
- N = ncol(dados)
- n = nrow(dados)
- nBS <- 5
- for (i in 1:N){
- y = dados[,i]
- lst <- lapply(1:N, function(x) matrix(sample(y,n,T), nrow = n, ncol = nBS))
- }
- > lst
- [[1]]
- [,1] [,2] [,3] [,4] [,5]
- [1,] 2 2 2 2 2
- [2,] 2 2 2 2 2
- [3,] 2 2 2 2 2
- [4,] 2 2 2 2 2
- [5,] 2 2 2 2 2
- [[2]]
- [,1] [,2] [,3] [,4] [,5]
- [1,] 2 2 2 2 2
- [2,] 2 2 2 2 2
- [3,] 2 2 2 2 2
- [4,] 2 2 2 2 2
- [5,] 2 2 2 2 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement