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
library(ggplot2) | |
library(dplyr) | |
# datos internos que vienen con ggplot2 | |
animals <- | |
msleep %>% slice_max(sleep_rem, n = 30) %>% # seleccionando top 30 | |
ggplot(aes(x = forcats::fct_reorder(name, sleep_total), y = sleep_total, label = name)) + | |
geom_bar(stat = "identity") + xlab("") + | |
geom_text(nudge_y = 2, hjust = 0) + | |
theme( |
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
## %######################################################%## | |
# # | |
#### Understanding a regular expression - your turn #### | |
# # | |
## %######################################################%## | |
# Write regular expressions to match: | |
# Test with stringr, regexplain, or a web-based regex tester | |
# "cute, cuuute, cuuuuuute, and cuuuuuuuuute" |
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
## %######################################################%## | |
# # | |
#### Regex for data cleaning - your turn #### | |
# # | |
## %######################################################%## | |
# 1. Download CRAN package descriptions | |
# 2. Select Package name, author, description, and all variables that end in 'ports' | |
# 3. Filter rows for packages with names that: | |
# - end in plot |
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 |
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
## %######################################################%## | |
# # | |
#### 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
## %######################################################%## | |
# # | |
#### 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
## %######################################################%## | |
# # | |
#### 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
## %######################################################%## | |
# # | |
#### 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
## %######################################################%## | |
# # | |
#### 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' |