I have a dataframe like this :
data.frame(id = c(1,2,3),
first_value=c("A","B","NA"),second_value=c("A","NA","D"),
first_date=c("2001",2010,2003),second_date=c("2003",2014,"2007"))
id first_value second_values first_date second_date
1 1 A A 2001 2003
2 2 B NA 2010 2014
3 3 NA D 2003 2007
I'am looking to transform it to longer dataframe like this with the samplist way:
id timing value date
1 1 first A 2001
2 1 second A 2003
3 2 first B 2010
4 2 second NA 2014
5 3 first NA 2003
6 3 second D 2007
I wasn't successful with the tidyr pivot_longer