I have the following data in R:
head(x)
col1 col2
[1,] "Id1" "Atr1"
[2,] "Id1" "Atr2"
[3,] "Id1" "Atr3"
[4,] "Id1" "Atr4"
[5,] "Id2" "Atr5"
[6,] "Id2" "Atr6"
I would like to transform x to have a dataframe in this form (with rows of nonequal length)
"Id1" "Atr1" "Atr2" "Atr3" "Atr4"
"Id2" "Atr5" "Atr6"