Last active
January 12, 2021 22:41
-
-
Save luisDVA/733153802e7b6122d0c716df806ad129 to your computer and use it in GitHub Desktop.
Unusable headers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## %######################################################%## | |
# # | |
#### Unusable variable names - your turn #### | |
# # | |
## %######################################################%## | |
# - Import the Marine Protected Areas data (MPAS-your.csv) | |
# - Make the variable names usable by placing all header fragments in a single | |
# header row | |
# - Clean the names for consistency | |
# load packages ----------------------------------------------------------- | |
library(readr) | |
library(unheadr) | |
library(dplyr) | |
library(janitor) | |
# import data ------------------------------------------------------------- | |
MPAs <- read_csv("data/MPAS-your.csv") | |
# fix headers ------------------------------------------------------------- | |
MPAs <- MPAs %>% mash_colnames(1) # warning can be ignored | |
# clean names ------------------------------------------------------------- | |
MPAs <- MPAs %>% clean_names() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment