Skip to content

Instantly share code, notes, and snippets.

@keithmcnulty
Created July 16, 2020 11:33
Show Gist options
  • Select an option

  • Save keithmcnulty/442bafb725f49f7ee4f85614065f8e1c to your computer and use it in GitHub Desktop.

Select an option

Save keithmcnulty/442bafb725f49f7ee4f85614065f8e1c to your computer and use it in GitHub Desktop.
wide_storms <- storms_sum %>%
tidyr::pivot_wider(names_from = "year", values_from = c("mean", "median"),
names_glue = "{.value}_of_{year}")
wide_storms
#> # A tibble: 3 x 7
#> status mean_of_1975 mean_of_1976 mean_of_1977 median_of_1975 median_of_1976
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hurri… 977. 975. 978. 984 975
#> 2 tropi… 1011. 1007. 1011. 1012. 1006.
#> 3 tropi… 992. 995. 1002. 993 994.
#> # … with 1 more variable: median_of_1977 <dbl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment