Re: [R] Selecting the first measurement only from a longitudinal sequence

From: jim holtman <jholtman_at_gmail.com>
Date: Fri, 25 Jul 2008 23:09:29 -0400

Is this what you want:

> x <- read.table(textConnection("ID Time Failuretime Censoringind longitudinalmeasure

+ 1  0     35                  0                123
+ 1  10    35                 0                 120
+ 1   25   35                 1                   123
+ 2   0    23                  0                   100
+ 2   10  23                  0                   111"), header=TRUE)

> do.call(rbind, lapply(split(x, x$ID), function(.grp) .grp[1,]))
  ID Time Failuretime Censoringind longitudinalmeasure
1  1    0          35            0                 123
2  2    0          23            0                 100

>
>
>

On Fri, Jul 25, 2008 at 3:31 PM, john james <dntssa_at_yahoo.com> wrote:
> Dear R-help mailing list,
>
> I have this problem, I have a joint longitudinal and survival data of the form say
>
> ID Time Failuretime Censoringind longitudinalmeasure
> 1 0 35 0 123
> 1 10 35 0 120
> 1 25 35 1 123
> 2 0 23 0 100
> 2 10 23 0 111
>
>
> I wish to create a new dataset such that only the first measurement is included.
>
> Also, i will appreciate if there is a function that i could call to do this because I will be applying it too in a simulation settings.
>
> Thank you for your time.
>
> James.
>
>
>
> [[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 you are trying to solve?

______________________________________________
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 Sat 26 Jul 2008 - 03:14:24 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 Sat 26 Jul 2008 - 03:32:16 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