Arun has given you a number of ways to do what you (seem to) want. If
this is fast enough, then you're done.
If not, then the key to speeding things up is to do things
differently. Note that a 1 x 9 matrix is a just a vector. Since each
element of the vector is a "different computation", apparentl
HI,
May be this helps:
example <- function(X,n){
lst1 <- list()
for(i in 1:n){
cell1 <- sample(X,1)
cell2 <- sample(X,1)
table1 <- cbind(cell1,cell2)
lst1[[i]] <- table1
}
do.call(rbind,lst1)
}
#or
example1 <- function(X,n){
table1 <- vector()
for(i in 1:n){
cell1 <- sample(X,1)
cell2 <- sample
2 matches
Mail list logo