[R] looping problem

Roslina Zakaria zroslina at yahoo.com
Thu Apr 24 10:47:41 CEST 2008

Dear r-expert,
I would like to generate 30 sets of random numbers from uniform distribution (0,1). Each set of random numbers should have 90 data.  Here is my code:
rand.no <- function(n,itr)
{ for (i in 1:itr)
  {rand.1 <- runif(n,0,1)
  if (i ==1) rand.2 <- rand.1
  else rand.2 <- cbind(rand.2,rand.1)
Question: The code is okay is just that it give me 31 sets instead of 30 sets. Can anybody any adjustment to my code.
Your help is really appreciated.
Thank you.

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

More information about the R-help mailing list