Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dgkeyes/4ec54d806645f19811f790b074e3c508 to your computer and use it in GitHub Desktop.
Save dgkeyes/4ec54d806645f19811f790b074e3c508 to your computer and use it in GitHub Desktop.
Letter case
## %######################################################%##
# #
#### 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment