I have a dataframe from where I want to make the values of a column as column names, but keep the values of other columns intact. Is there an efficient way to do this is R?
Sample example
Answer Freq Number Question Perc
7 Q1 A 1.54
Yes 243 Q1 A 53.52
No 204 Q1 A 44.93
I want to transform this to the following
Yes No " " Number Question Yes_Perc No_Perc ""_Perc
243 204 7 Q1 A 53.52 44.93 1.54
I tried with dcast from reshape2 but its not working. Any help would be great