Use the tapply() function as in tapply(b,m,sum) HTH, Daniel
mousy0815 wrote: > > ... > > I wanted to get the sum of the probability at all the values of "b" (ie. > Probability(10, 0.1, 1, 1, 4, 5) + Probability(10, 0.1, 1, 2, 4, 5)... + > Probability(10, 0.1, 1, 9, 4, 5). For that I can just use the sum() > function right? > But since m is the time steps, is it possible for me to input m and b and > get the sum mentioned before at each value of m? > So like ((Probability(10, 0.1, 1, 1, 4, 5) + Probability(10, 0.1, 1, 2, 4, > 5)... + Probability(10, 0.1, 1, 9, 4, 5)), Probability(10, 0.1, 2, 1, 4, > 5) + Probability(10, 0.1, 2, 2, 4, 5)... + Probability(10, 0.1, 2, 9, 4, > 5)...) > > ... > -- View this message in context: http://r.789695.n4.nabble.com/Summation-resulting-in-a-list-tp3660514p3660576.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.