[Solved] How to pivot my data frame in R so that it turns into another data frame in this specific format? [duplicate]


library(tidyr)
df %>% gather(value="amount",key='Type',-SubDept2) %>% head(n=5)

       SubDept2        Type amount
1         Admin BasicSalary  10000
2           Bar BasicSalary   9880
3 Entertainment BasicSalary  11960
4           F&B BasicSalary   9680
5       Finance BasicSalary  10310

2

solved How to pivot my data frame in R so that it turns into another data frame in this specific format? [duplicate]