If I have data from:
df <- data.frame(x=sample(letters[1:20], replace=T),
y=sample(letters[1:20], replace=T), z=sample(1:10, replace=T))
and I want to stack the x and y 'id' columns, and thus repeat the value, how would I do that?
So, pretend the first row of the data frame is
x y z
1 p r 5
I want the first row in a reshaped data frame to look like:
id value
1 p 5
2 r 5