0

i am given the following data:

temperatures <- tibble(
month = c("January", "January", "May", "May", "September", "September"), statistic_type = c( "max", "min", "max", "min", "max", "min"),
value = c(19, 11, 13, 6, 13, 6)
)

and need to convert it into a different format to get this result: enter image description here

jpsmith
  • 11,023
  • 5
  • 15
  • 36
  • https://stackoverflow.com/search?q=%5Br%5D+reshape+long+to+wide – rawr May 28 '22 at 01:51
  • `tidyr::pivot_wider(temperatures, names_from = "statistic_type", values_from = "value")` should do it. See the linked FAQ for more explanation and other options (though I'd strongly recommend sticking with the `tidyr` package for now) – Gregor Thomas May 28 '22 at 02:30

0 Answers0