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
## %######################################################%## | |
# # | |
#### Putting everything together #### | |
#### Chained data cleaning demonstration #### | |
# # | |
## %######################################################%## | |
# Load the raw Age of Empires units dataset from csv (aoe_raw.csv) | |
# Identify and fix common issues that make these data unusable |
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
## %######################################################%## | |
# # | |
#### Parsing numbers - your turn #### | |
# # | |
## %######################################################%## | |
# Import the Marine Protected Areas dataset (MPAS-mine.csv) | |
# Subset to keep only the MPA names and columns with extent data | |
# Make the columns that hold the MPA extent into usable numeric variables | |
# Watch out for decimals |
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
## %######################################################%## | |
# # | |
#### Empty rows and columns - your turn #### | |
# # | |
## %######################################################%## | |
# Import the Marine Protected Areas dataset (MPAS-your.csv) | |
# Identify the empty rows and columns, and create a new object with only the empty rows and columns | |
# Remove the empty rows and columns |
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
## %######################################################%## | |
# # | |
#### Broken values - your turn #### | |
# # | |
## %######################################################%## | |
# Load the raw Age of Empires units dataset from csv (aoe_raw.csv) | |
# Identify the broken values in both the 'Type' and 'Name' columns and unbreak them | |
# Clean up any separator-related issues arising from the 'unbreaking' |
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
## %######################################################%## | |
# # | |
#### Duplicates - your turn #### | |
# # | |
## %######################################################%## | |
# Load the messy Age of Empires units dataset bundled with `unheadr` (AOEunits_raw) | |
# Keep only units of Type "Cavalry" | |
# Identify duplicated records across all variables | |
# Remove duplicated records across all variables |
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
## %######################################################%## | |
# # | |
#### Compound values - your turn #### | |
# # | |
## %######################################################%## | |
# Import the Marine Protected Areas dataset (MPAS-your.csv) | |
# Separate the country codes variable (ISO3 and UN scheme) | |
# Unnest the Reference variable | |
# > Keep an eye on the separators |
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
## %######################################################%## | |
# # | |
#### Missing, implicit, or misplaced #### | |
#### grouping variables - your turn #### | |
# # | |
## %######################################################%## | |
# Load the `primates2017` dataset bundled with 📦 `unheadr` | |
# Create a new column that groups the different species by taxonomic family. | |
# In biology, taxonomic families all end in the suffix "_DAE_" |
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
## %######################################################%## | |
# # | |
#### Letter case - your turn #### | |
# # | |
## %######################################################%## | |
# Import the Marine Protected Areas dataset (MPAS-your.csv) | |
# Summarize the number of Marine Protected Areas by country (Country full). |
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
## %######################################################%## | |
# # | |
#### Whitespace - your turn #### | |
# # | |
## %######################################################%## | |
# - Import the Marine Protected Areas data (MPAS-your.csv) from the previous lesson | |
# - check the Country variable for leading or trailing whitespace | |
# - Remove it if necessary. |
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 |