Hi, R users, I have a problem about how to generate random sample interval from a duration. For example, during a time duration 0-70s, I want to generate a sample which last 10s. the sample could be 0-10 or 30-40s or 25-35s etc How could I do it in R`?? Thanks a lot. Tammy _________________________________________________________________ Share your memories online with anyone you want. http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1 [[alternative HTML version deleted]]
I need a simple algorithm to generate random ranges.> From: metal_licaling@live.com > To: r-help@r-project.org > Date: Mon, 24 Aug 2009 09:55:35 +0300 > Subject: [R] Generate random sample interval > > > Hi, R users, > > I have a problem about how to generate random sample interval from a duration. > > For example, during a time duration 0-70s, I want to generate a sample which last 10s. > the sample could be 0-10 or 30-40s or 25-35s etc > How could I do it in R`?? > > Thanks a lot. > > Tammy > > _________________________________________________________________ > Share your memories online with anyone you want. > http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1 > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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._________________________________________________________________ Show them the way! Add maps and directions to your party invites. http://www.microsoft.com/windows/windowslive/products/events.aspx [[alternative HTML version deleted]]
On Aug 24, 2009, at 2:55 AM, Tammy Ma wrote:> > Hi, R users, > > I have a problem about how to generate random sample interval from a > duration. > > For example, during a time duration 0-70s, I want to generate a > sample which last 10s. > the sample could be 0-10 or 30-40s or 25-35s etc > How could I do it in R`???runif Wouldn't you just generate a runif variable for the starting time that was in the range of 0-60 and then add 10 to each such start time? If the problem is any more difficult, then you will need to be more precise. David Winsemius, MD Heritage Laboratories West Hartford, CT