I have some data that looks like this
color value_morning quality_morning value_evening quality_evening value_night quality_night
red 10 good 9 good 10 good
blue 7 bad 8 great 10 great
green 7 bad 8 good 6 bad
and I am trying to use pivot_longer() (or any other tidy method) to transform it into:
color value time
red 10 morning
blue 7 morning
green 7 morning
red 9 evening
blue 8 evening
green 8 evening
red 10 night
blue 10 night
green 6 night
I don't need the quality_ data, just the value_ data.
I tried creating a vector that looked like labels <- c("value_morning", "value_evening", "value_night") and running df %>% pivot_longer(cols = labels) but that didn't work. Any help is appreciated!