Re: [R] Model To Simulate Dice Roll

2022-04-22 Thread David Carlson via R-help
Sorry, The last three lines should read: all <- apply(results, 1, function(x) length(intersect(x, seq(sides)))==sides) sum(all)/reps results <- as.data.frame(results) To generalize them for values of sides other than 6. On Fri, Apr 22, 2022 at 11:05 PM Paul Bernal wrote: > Thank you so much

Re: [R] Model To Simulate Dice Roll

2022-04-22 Thread Paul Bernal
Thank you so much David! El El vie, 22 de abr. de 2022 a la(s) 11:04 p. m., David Carlson < dcarl...@tamu.edu> escribió: > Since the rolls are independent, it is not necessary to separate the rolls > into two stages: > > sides <- 6 > months <- 12 > reps <- 100 > > set.seed(2022) > results <-

Re: [R] Model To Simulate Dice Roll

2022-04-20 Thread Paul Bernal
Dear Bert, Thank you for your kind reply. That is fine, I appreciate your feedback anyway. Have a great day/night. Best, Paul El mié, 20 abr 2022 a las 23:31, Bert Gunter () escribió: > I believe I gave you sufficient information (the vector of dice roll > results would replace 1:36 in my

Re: [R] Model To Simulate Dice Roll

2022-04-20 Thread Bert Gunter
I believe I gave you sufficient information (the vector of dice roll results would replace 1:36 in my example). Furthermore, this sounds like homework, which we try not to do here. But even if it is not, I expect you to fill in the details based on what I have provided. If I have misunderstood

Re: [R] Model To Simulate Dice Roll

2022-04-20 Thread Bert Gunter
If I understand you correctly, it's simple. Matrices in R are vectors with a dimension attribute. By default, they are populated column by column. Use 'byrow = TRUE to populate by row instead. For example: > matrix (1:36, ncol = 12, byrow = TRUE) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]