Last active
June 28, 2021 19:57
-
-
Save luisDVA/37da8310a4f7e7bac640783cb30cc139 to your computer and use it in GitHub Desktop.
Letter case
This file contains 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
## %######################################################%## | |
# # | |
#### Letter case - your turn #### | |
# # | |
## %######################################################%## | |
# Import the Marine Protected Areas dataset (MPAS-your.csv) | |
# Summarize the number of Marine Protected Areas by country (Country full). | |
# load packages ----------------------------------------------------------- | |
library(readr) | |
library(stringr) | |
library(dplyr) | |
library(unheadr) | |
library(janitor) | |
library(snakecase) | |
# import data ------------------------------------------------------------- | |
MPAs <- read_csv("data/MPAS-your.csv") %>% | |
mash_colnames(1) %>% | |
clean_names() | |
# clean strings and summarize --------------------------------------------- | |
MPAs %>% | |
mutate(country_full = to_title_case(country_full, parsing_option = 0)) %>% | |
count(country_full, name = "number_of_MPAS", sort = TRUE) %>% | |
na.omit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment