Selecting the first measurement only from a longitudinal sequence
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?