Below I first successfully long-format my dat
, but when I try to convert it back to its original wide-format I don't get the same output.
Is there a fix for this?
library(tidyverse)
ACGR <- read.csv('https://raw.githubusercontent.com/rnorouzian/e/master/ACGR%202010-11%20to%202016-17.csv', na = "---")
dat <- ACGR %>%
pivot_longer(names_to = "year", values_to = "grad_rate", cols = SY2010_11:SY2016_17)
dat %>%
pivot_wider(year, grad_rate) ## doesn't return to ACGR format HERE
year
<chr>
1 SY2010_11
2 SY2011_12
3 SY2012_13
4 SY2013_14
5 SY2014_15
6 SY2015_16
7 SY2016_17