Using dplyr I would like to transpose the dataframe below.
I used : t() but it didn't register my column names as a column. Additionally, I want to name the columns
df <- structure(list(anger = 4083, anticipation = 7023, disgust = 2551,
fear = 6983, joy = 4316, negative = 9234, positive = 17198,
sadness = 3690, surprise = 2996, trust = 11146), row.names = c(NA,
-1L), class = c("tbl_df", "tbl", "data.frame"))
Preferably this should be arranged by count.
**sentiment count**
anger 4083
anticipation 7023
disgust 2551
fear 6983
joy 4316
negative 9234
positive 17198
sadness 3690
surprise 2996
trust 11146