Here I am generating a list of matrix objects.
c<-11
l<-10
v<-list()
p<-100
for(i in 1:p) {
m<-matrix(sample(c(-1,1),l*c,replace=TRUE),l,c)
v[[i]]<-m
}
At this point, I am trying to randomly sample with replacement a matrix element from the list vector 'v'.
sample(v,size=11,replace=TRUE)
But this sample function returns the first 11 elements, instead of randomly selecting from the 100 elements in 'v'.
First, how do I randomly select matrix objects from 'v' and store those random samples in a new object?