[R] Counting the numbers of items in vector according to their size

rlcorp mr.rcorp at gmail.com
Fri Nov 9 18:57:12 CET 2012


I am new to R and learned to program 10 years ago in C++. I am currently
working a project that looks at the distribution of randomly generated beta
values. I take 20 random beta values find their sum, repeat 100000 times.

Here is my code that it took me 4 hours to get

s=numeric(length=100000)
for(i in 1:100000){
  pop=(rbeta(n=20,shape1=2,shape2=1))
  s[i]=sum(pop)
}

So now I have them all in in vector, I would like to maybe sort or count
them to see how many are less than or equal to 10, but am guessing there is
a density r function that may be easier then that. 



--
View this message in context: http://r.789695.n4.nabble.com/Counting-the-numbers-of-items-in-vector-according-to-their-size-tp4649085.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list