[R] Help with sample function

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Wed Jun 7 17:12:00 CEST 2006


try something like:

surv.data <- data.frame(times = rexp(100, 1/10), events = rbinom(100, 
1, 0.7))
surv.data[sample(nrow(surv.data), replace = TRUE), ]


I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Matthew Austin" <maustin at hsph.harvard.edu>
To: <r-help at stat.math.ethz.ch>
Sent: Wednesday, June 07, 2006 3:57 PM
Subject: [R] Help with sample function


>I have generated some some survival times and censoring indicators.
> Thus I have an ordered pair for each observation. How do I sample 
> these
> ordered paris? I only know how to sample from a vector? I would
> appreciate any help I could get.
>
> Thanks
> Matt
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the R-help mailing list