A reproducible example would be nice to illustrate your problem, since you didn't give us such example I just assume a List
and made some replications
List <- list(c(2,1,3,4,5,6), c(1,4,5,7,0,6), c(2,4,7,9,3,1))
set.seed(001)
replicate(3, lapply(List, sample, 7, replace=TRUE), simplify = FALSE)
which produces
[[1]]
[[1]][[1]]
[1] 1 3 4 6 1 6 6
[[1]][[2]]
[1] 7 7 1 4 4 0 5
[[1]][[3]]
[1] 3 7 3 1 7 3 1
[[2]]
[[2]][[1]]
[1] 1 4 2 1 3 2 3
[[2]][[2]]
[1] 6 5 5 7 5 4 0
[[2]][[3]]
[1] 3 3 2 3 7 3 9
[[3]]
[[3]][[1]]
[1] 5 4 4 5 2 3 5
[[3]][[2]]
[1] 0 5 6 5 4 1 1
[[3]][[3]]
[1] 4 9 9 7 1 4 7
Note that this approach will give you a resampled data (with replacement) for each element of your original list, that's why each replication is a list consisting in three elements each one.
If you write sapply
instead of lapply
inside replicate(...)
the resulting output would be nicer.
set.seed(001)
replicate(3, sapply(List, sample, 7, replace=TRUE), simplify = FALSE)
[[1]]
[,1] [,2] [,3]
[1,] 1 7 3
[2,] 3 7 7
[3,] 4 1 3
[4,] 6 4 1
[5,] 1 4 7
[6,] 6 0 3
[7,] 6 5 1
[[2]]
[,1] [,2] [,3]
[1,] 1 6 3
[2,] 4 5 3
[3,] 2 5 2
[4,] 1 7 3
[5,] 3 5 7
[6,] 2 4 3
[7,] 3 0 9
[[3]]
[,1] [,2] [,3]
[1,] 5 0 4
[2,] 4 5 9
[3,] 4 6 9
[4,] 5 5 7
[5,] 2 4 1
[6,] 3 1 4
[7,] 5 1 7