[R] Problems replicating rows and associated increasing index

From: Niccolò Bassani <biostatistica_at_gmail.com>
Date: Thu 18 Jan 2007 - 14:45:53 GMT


I have a dataset like this:

ID        value     week of visit
1          4.2              0  (baseline)
1          2.5              6
1          4.1              10
1          3.0              12

.
.
.

And so on for more than 11000 records (more than 1000 subjects). I need to add rows in order to have 52 records per patients (corresponding to the 52 weeks of the year); that is that weeks 1-2-3-4-5 will have the same content of baseline one, except for the column "week of visit". The fact is that each of the rows can have a very different timing, so the only thing I can do is creating a vector giving the number of replications needed for each row, but how can I practically replicate them increasing the index ok the week?
thanks
niccolò

        [[alternative HTML version deleted]]



R-help@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 and provide commented, minimal, self-contained, reproducible code. Received on Fri Jan 19 01:52:58 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 18 Jan 2007 - 16:30:23 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.