Suppose we have this data frame:
avg_1 avg_2 avg_3 avg_4
132 123 23 214
DF DM RF RM
How can I convert this in R so that the output is a new data frame that looks like:
avg key
132 DF
123 DM
23 RF
214 RM
I have tried using pivot_longer from tidyverse, but the trouble is that I'm also trying to rename the columns to avg and key. Can anyone help?