> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of raymond chiruka > Sent: Thursday, April 19, 2007 5:23 AM > To: [email protected] > Subject: Re: [R] Random number generator in R compared > > I am trying to generate survival data using R .Im trying to randomly > generate a > column of 1s and 0 and another column randomly generated using an exponential > distribution but l cant seem to get the random function. how do l go about it > > thanks in advance > > rt chiruka >
To get your random column of 0's and 1's try ?sample. y <- sample(c(0,1), size=100, replace=TRUE) For your random sample from an exponential distribution try ?rexp x <- rexp(100) Hope this is helpful, Dan Dan Nordlund Bothell, WA ______________________________________________ [email protected] 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.
