Re: [R] Recoding dates to session id in a longitudinal dataset

From: John-Paul Bogers <john-paul.bogers_at_ua.ac.be>
Date: Sun, 27 Jun 2010 07:56:31 +0200

Dear Jim,

he data concerns HPV screening data.
The data looks as follows
pat1 sampledate1 HPV16 0.3
pat2 sampledate2 HPV16 0
pat3 sampledata3 HPV16 0.5
pat1 sampledate4 HPV16 0.6
pat4 sampledate5 HPV16 0
pat2 sampledate6 HPV16 0
pat1 sampledate7 HPV16 0

What I would like is

pat1 1 HPV16 0.3
pat2 1 HPV16 0
pat3 1 HPV16 0.5
pat1 2 HPV16 0.6
pat4 1 HPV16 0
pat2 2 HPV16 0
pat1 3 HPV16 0

I would like to recode sampledate (real date, in date format) to session sequence (first sample of this patient, second sample of this patient, ....)

I hope this makes it clear.

Thanks

JP

PS: I answered this as a reply to your private mail, how do I get this on the mailinglist?
 On Sat, Jun 26, 2010 at 7:59 PM, jim holtman <jholtman_at_gmail.com> wrote:

> It would be useful if you could provide an example of what the data
> looks like now and what you would like it to look like; otherwise it
> is impossible to help.
>
> On Sat, Jun 26, 2010 at 8:37 AM, John-Paul Bogers
> <john-paul.bogers_at_ua.ac.be> wrote:
> > Hi,
> >
> > I'm fairly new to R but I have a large dataset (300000 obs) containing
> > patient material. Some patients came 2-9 times during the three year
> > observation period. The patients are identified by a unique idnr, the
> > sessions can be distinguished using the session date. How can I recode
> the
> > date of the session to a session id (1-9). This would be necessary to
> obtain
> > information and do some analysis on the first occurence of a specific
> > patient or to look for trends.
> >
> > Thanks
> >
> > JP Bogers
> > University of Antwerp
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help_at_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.
> >
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solve?
>

        [[alternative HTML version deleted]]



R-help_at_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. Received on Sun 27 Jun 2010 - 06:01:19 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 27 Jun 2010 - 06:50:35 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.

list of date sections of archive