Skip to content
Prev 76398 / 398502 Next

aggregate

maybe you could use something like this:

dat <- data.frame(id = rep(1:3, 3), date = as.Date(rep(c("2005-08-25", 
"2005-08-26", "2005-08-29"), each = 3)))
########################
do.call("rbind", lapply(split(dat, dat$id), function(x) data.frame(id 
= x$id[1], start = min(x$date), end = max(x$date))))


I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Omar Lakkis" <uofiowa at gmail.com>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, August 30, 2005 4:36 PM
Subject: [R] aggregate