-1

I have a df that looks like this:

df <- data.frame("Country" = c("A","A", "B", "C"), "Date" = c("2021-01-02", "2021-01-03", "2021-01-01", "2021-01-02"), "Age" = c(21,15, 27,42))

I would like to extend this df based on Date and Country. Desired output is:

full_df <- data.frame("Country" = c("A","A", "A", "B", "B", "B", "C", "C", "C"), "Date" = c("2021-01-01","2021-01-02", "2021-01-03", "2021-01-01","2021-01-02", "2021-01-03","2021-01-01","2021-01-02", "2021-01-03"), "Age" = c(NA, 21, 15, 27, NA, NA, NA, 42, NA))

How can I do this please?

vojtam
  • 855
  • 2
  • 21

0 Answers0