I have group ID's in data. These group ID's can have different dates. SO i need to replace the date's for the matching ID's to the earliest of the ID's. EX:
group ID: 1, 2, 4, 4, 4,
Date: 3/2, 3/2, 3/2, 3/4, 3/6
I need the matching group ID's -- 4 -- to all be set to have a date of 3/2. I want to keep all of the other information pertaining to that group id line unique, but the dates need to be changed to all be 3/2. So ultimately, 3 entries of group id 4 all with a date of 3/2.
If your date variable is of class "Date", then it should be no problem.
df _new <- df %>%
# group by ID
group_by(ID) %>%
# create new date variable (the one you need), which is the earliest date per id. "Date" is here your original date variable.
mutate(date_new =min(Date))