Re: [R] Looping through all matrix columns each 1 row at a time

2022-04-21 Thread Eric Berger
Hi Paul, I am not sure I understand your question, but perhaps the following is helpful. In particular, the apply() function used with MAR=1, applies a function to a matrix row-wise. set.seed(123) m <- matrix(sample(1:6,5*12,replace=TRUE),ncol=12) ## dummy data m [,1] [,2] [,3] [,4] [,5] [,6]

[R] Looping through all matrix columns each 1 row at a time

2022-04-20 Thread Paul Bernal
Dear R friends, One question, so, thanks to the Bert's kind feedback, I was able to create my matrix using the following code: dice_rolls = 120 num_dice = 1 dice_sides = 6 #performing simulation dice_simul = data.frame(dice(rolls = dice_rolls, ndice = num_dice, sides = dice_sides, plot.it = TRU