The following should do what you're hoping for:
library(tidyverse)
library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#>
#> date, intersect, setdiff, union
samples <- tribble(
~id, ~blood_sample,
1, "01.01.2010",
1, "04.02.2012",
1, "05.02.2013",
1, "06.08.2014",
1, "08.10.2018",
2, "04.07.2015",
2, "03.06.2018",
3, "12.12.2012",
3, "11.05.2015",
3, "05.11.2018"
)
samples %>%
mutate(blood_sample = mdy(blood_sample)) %>%
group_by(id) %>%
arrange(blood_sample) %>%
mutate(first_sample = first(blood_sample)) %>%
ungroup() %>%
arrange(id)
#> # A tibble: 10 x 3
#> id blood_sample first_sample
#> <dbl> <date> <date>
#> 1 1 2010-01-01 2010-01-01
#> 2 1 2012-04-02 2010-01-01
#> 3 1 2013-05-02 2010-01-01
#> 4 1 2014-06-08 2010-01-01
#> 5 1 2018-08-10 2010-01-01
#> 6 2 2015-04-07 2015-04-07
#> 7 2 2018-03-06 2015-04-07
#> 8 3 2012-12-12 2012-12-12
#> 9 3 2015-11-05 2012-12-12
#> 10 3 2018-05-11 2012-12-12
Created on 2021-08-02 by the reprex package (v2.0.0)