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

2012-11-09 Thread Rui Barradas
Hello, As you know R better it will take you less and less time to get it right, and almost surely less and less lines of code to do the same thing. Here's a one liner: set.seed(1510) s=numeric(length=10) for(i in 1:10){ pop=(rbeta(n=20,shape1=2,shape2=1)) s[i]=sum(pop) } set.se

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

2012-11-09 Thread rlcorp
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 10 times. Here is my code that it took me 4 hours to get s=numeric(length=10) fo