[R] reformat data for time-varying Cox

From: <r.ghezzo_at_staff.mcgill.ca>
Date: Thu 28 Jul 2005 - 03:46:00 EST


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



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 Received on Thu Jul 28 03:55:29 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:34:06 EST