df <- data.frame(country = c("US", "UK", "US"), year = c(2020, 2020, 2021))
make_id(df, country, year)
#> .id country year
#> 1 US|2020 US 2020
#> 2 UK|2020 UK 2020
#> 3 US|2021 US 2021
Run the code above in your browser using DataLab