[R] looping problem

From: Roslina Zakaria <zroslina_at_yahoo.com>
Date: Thu, 24 Apr 2008 01:47:41 -0700 (PDT)

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.

R-help_at_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. Received on Thu 24 Apr 2008 - 08:53:46 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Apr 2008 - 10:30:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive