[R] Looping through all matrix columns each 1 row at a time
Paul Bernal
p@u|bern@|07 @end|ng |rom gm@||@com
Thu Apr 21 06:55:20 CEST 2022
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 = TRUE))
dice_simul
prob_matrix <- matrix(dice_simul[,1], ncol = 12, byrow = TRUE)
colnames(prob_matrix) <-
c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
Now, I need to perform an analysis for each column, one row at a time. For
example, I need to know if numbers 1 through 6 all appear in the twelve
column for row 1, then for row 2, etc.
Any guidance will be greatly appreciated.
Best,
Paul
[[alternative HTML version deleted]]
More information about the R-help
mailing list