# A tibble: 6 × 15
name state pop2000 pop2010 pop2017 pop_change poverty homeownership
<chr> <fct> <dbl> <dbl> <int> <dbl> <dbl> <dbl>
1 Autauga County Alaba… 43671 54571 55504 1.48 13.7 77.5
2 Baldwin County Alaba… 140415 182265 212628 9.19 11.8 76.7
3 Barbour County Alaba… 29038 27457 25270 -6.22 27.2 68
4 Bibb County Alaba… 20826 22915 22668 0.73 15.2 82.9
5 Blount County Alaba… 51024 57322 58013 0.68 15.6 82
6 Bullock County Alaba… 11714 10914 10309 -2.28 28.5 76.9
# ℹ 7 more variables: multi_unit <dbl>, unemployment_rate <dbl>, metro <fct>,
# median_edu <fct>, per_capita_income <dbl>, median_hh_income <int>,
# smoking_ban <fct>
Shortening the columns
tidycounty <- county |># pivot longer is used when there is data in the column names typically yearspivot_longer(cols =starts_with("pop2"),names_to ="year",values_to ="population", ) |>mutate(year =parse_number(year)# or you could do (Year = str_sub(Year,4,7)) which takes a new string from position 4 to 7 )