Hello, I have a simple data set as follows:
df = data.frame(letters = c("a","a","b","b","c","c"),
bin = rep(c("cat1","cat2"),3),
num1 = c(1:6),
num2 = c(7:12))
I need to transpose (kind of rotation data 90 degrees clockwise) it from long to wide , and having something similar as below:
col_to_row a1 a2 b1 b2 c1 c2
1 letters a a b b c c
2 bin cat1 cat2 cat1 cat2 cat1 cat2
3 num1 1 2 3 4 5 6
4 num2 7 8 9 10 11 12
I tried to use dplyr and tidyverse function but could not get there.
I would have appreciated any suggestion.
Thank you.