[R] Cleaning date columns

From: Newbie19_02 <nvanzuydam_at_gmail.com>
Date: Wed, 09 Mar 2011 03:20:18 -0800 (PST)


Hi Everyone,

I have the following problem:

data <- structure(list(prochi = c("IND1", "IND1", "IND1",
"IND2", "IND2", "IND2", "IND2", "IND3",
"IND4", "IND5"), date_admission = structure(c(6468,
6470, 7063, 9981, 9983, 14186, 14372, 5129, 9767, 11168), class = "Date")), .Names = c("prochi",
"date_admission"), row.names = c("27", "28", "21", "86", "77",
"80", "1", "114", "192", "322"), class = "data.frame")

I have records for individuals that were taken on specific dates. Some of the dates are within 3 days of each other. I want to be able to clean my date column and select the earliest of the dates that occur within 3 days of each other per individual as a single observation that represents the N observations. So for example:

input:
IND1 1987-09-17

IND1     1987-09-19
IND1     1989-05-04

output:
IND1 1987-09-17
IND1 1989-05-04 I'm not sure where to start with this?

Thanks,
Nat  

--
View this message in context: http://r.789695.n4.nabble.com/Cleaning-date-columns-tp3343359p3343359.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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 Wed 09 Mar 2011 - 12:43:32 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 Thu 10 Mar 2011 - 01:50:20 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