[R] reformat data for time-varying Cox

r.ghezzo@staff.mcgill.ca r.ghezzo at staff.mcgill.ca
Wed Jul 27 19:46:00 CEST 2005

Hello, using R2.1.1 in Win XP
I have data in the format
ID , DateOfEntry, Drug0, DateVisit1, Drug1, DateVisit2, Drug2, DateOfDeath
The DateOfDeath can be 999 if the patient is still alive at end of study.
The number of visits can be 2, 3 or 4 per patient
I want to do a time varying Cox analysis, so I need the data as:
ID   from  to   drug   censor
with a line for each visit.
I searched the RSiteSearch but I could not find anything but I remember that
somebody some time ago presented to the list a mini function that recoded the
data so it could be used in this manner.
If somebody in the list have a copy of that function I will appreciate if he/she
send me a copy. I tried to program it but got into a knot of spaghetti code that
is impossible to debug, at least by me.
Thanks for any help
Heberto Ghezzo Ph.D.
McGill University
Montreal - Canada

More information about the R-help mailing list