I am trying to use ddply with transform to populate a new variable (summary_Date) in a dataframe with variables ID and
ddply
transform
summary_Date
ID
One Step ddply solution (also posted as comment)
ddply(test.df, .(ID, floor_date(Date, "month")), mutate, length_x = length(ID), summary_Date=as.POSIXct(ifelse(length_x < 5, round_date(Date, "month") ,Date) , origin="1970-01-01 00:00.00", tz="GMT") )