aggregate
How can I aggregate this data.frame to list the min and max date for each unique id?
From this :
r = data.frame(id=rep(seq(1:3), 3), date= as.Date(c(rep("2005-08-25",3), rep("2005-08-26",3), rep("2005-08-29", 3)), "%Y-%m-%d"))
r
id date 1 2005-08-25 2 2005-08-25 3 2005-08-25 1 2005-08-26 2 2005-08-26 3 2005-08-26 1 2005-08-29 2 2005-08-29 3 2005-08-29 I want to get to this:
id start end 1 2005-08-25 2005-08-29 2 2005-08-25 2005-08-29 3 2005-08-25 2005-08-29 I tried aggregate and aggregate.data.frame but the date column keeps getting converted into a number.