I have a long matrix which I want to fill with rnorm(1)
but it takes much time (unlike this sample below). Is there an alternative way since the number of rows and columns will always be equal but dynamic.
my <- matrix(c(0), nrow= 3, ncol = 3)
for (i in 1:3){
for (j in 1:3){
my[i,j]<-rnorm(1)
}
}
Aucun commentaire:
Enregistrer un commentaire