change data frame columns to rows
- by Sol Lago
Sorry if this is obvious: I found a lot of questions similar to mine but I can't figure it out for my own data. I have a data frame that looks like this:
A <- c(1,6)
B <- c(2,7)
C <- c(3,8)
D <- c(4,9)
E <- c(5,0)
df <- data.frame(A,B,C,D,E)
df
A B C D E
1 1 2 3 4 5
2 6 7 8 9 0
And I need this:
df
X1
A 1
A 6
B 2
B 7
C 3
C 8
D 4
D 9
E 5
E 0
Thanks!