Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b-rodrigues/2130283453834ebdb333707e8949ea73 to your computer and use it in GitHub Desktop.
Save b-rodrigues/2130283453834ebdb333707e8949ea73 to your computer and use it in GitHub Desktop.
library(tidyverse)
data("population")
head(population)
pop_wide <- population %>%
pivot_wider(names_from = country, values_from = population)
pop_wide %>%
pivot_longer(-year, names_to = "pais", values_to = "população")
# -year: select all but the "year" column
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment