I want to repeat heach column into a new row as the next example:
Date<- c(seq(as.Date("2000/1/1"), by = "month", length.out = 3))
A<- c(seq(2,4,length.out=3))
B<- c(seq(20,40,length.out=3))
df <- (data.frame(Date,A,B))
df
Date A B
1 2000-01-01 2 20
2 2000-02-01 3 30
3 2000-03-01 4 40
I would like to have this:
# Final dataframe
Date Site Value
1 2000-01-01 A 2
2 2000-02-01 A 3
3 2000-03-01 A 4
4 2000-01-01 B 20
5 2000-02-01 B 30
6 2000-03-01 B 40
is there a function to make this?