lundi 22 février 2021

R: How do I store the outputs of 1000 die rolls, 6 times into a matrix?

How do I repeat a function n times and bind the vector outputs into a matrix? Or rather, how do I improve my function to get the intended result?

So far I have:


sample(1:6, 1000, rep = TRUE)

Have tried making into a function, but am stuck here.

droll_func = function(t){
    sample(1:6, 1000, rep = TRUE)
}




Aucun commentaire:

Enregistrer un commentaire