[R] Event History Data Recoding

Thomas Jensen thomas.jensen at eup.gess.ethz.ch
Fri Apr 23 17:18:42 CEST 2010


Thanks Josh,

But I am not sure if the reshape function can create new rows based on
the meeting variable. For the second act there are three meetings, i.e.
one meeting between discussion and agreement, and this should be entered
as a separate row.

Best, Thomas

On Fri, 2010-04-23 at 07:45 -0700, Joshua Wiley wrote:
> If you are talking about changing from a "wide" format to "long" take a look at
> 
> ?reshape
> 
> 
> ---
> Josh
> 
> On Fri, Apr 23, 2010 at 7:09 AM, Thomas Jensen
> <thomas.jensen at eup.gess.ethz.ch> wrote:
> > Dear R list,
> >
> > I have an event history data set that is structured like this:
> >
> > Legislative act     Discussion     Agreement     Time     Event
> > Act1                2006-05-30     2006-06-19     20        1
> > Act2                2004-03-01     2004-06-14     105       1
> > .
> > .
> > .
> >
> > I have information on the meetings in the legislature between adoption
> > periods in a separate variable (the start and stop dates are included):
> >
> > Act1 meeting:2006-05-30, 2006-06-19.
> > Act2 meeting: 2004-03-22, 2004-04-26, 2004-06-14.
> >
> > I want to code this as a discrete event data set, so it should look like
> > this:
> >
> > Legislative act     Event     Meeting     Time Count
> > Act1                  0       2006-05-30      1
> > Act1                  1       2006-06-07      2
> > Act2                  0       2004-03-22      1
> > Act2                  0       2004-04-26      2
> > Act2                  1       2004-06-14      3
> >
> > Can anyone tell me if it is possible to do this recoding in R, or do I
> > have to do it by hand?
> >
> > Best, Thomas
> >
> > ______________________________________________
> > 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.
> >
> 
> 
> 



More information about the R-help mailing list