[R] Summation resulting in a list?

Daniel Malter daniel at umd.edu
Mon Jul 11 21:30:07 CEST 2011


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.



More information about the R-help mailing list