Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Looking for work opportunities

Luis Verde Arregoitia luisDVA

💭
Looking for work opportunities
View GitHub Profile
View common-issues-06_duplicates.R
## %######################################################%##
# #
#### 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
View common-issues-05_compound-values.R
## %######################################################%##
# #
#### 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
@luisDVA
luisDVA / common-issues-04_emb-subheaders.R
Created Nov 25, 2020
Missing, implicit, or misplaced grouping variables
View common-issues-04_emb-subheaders.R
## %######################################################%##
# #
#### 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_"
View common-issues-03_lettercase.R
## %######################################################%##
# #
#### Letter case - your turn ####
# #
## %######################################################%##
# Import the Marine Protected Areas dataset (MPAS-your.csv)
# Summarize the number of Marine Protected Areas by country (Country full).
View common-issues-02_whitespace.R
## %######################################################%##
# #
#### 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.
View common-issues-01_unusable-headers.R
## %######################################################%##
# #
#### 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
View regex-02_regex-4-data-cleaning.R
## %######################################################%##
# #
#### 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
@luisDVA
luisDVA / regex-01_understanding-regex.R
Last active Nov 24, 2020
Understanding a regular expression - your turn: Solutions
View regex-01_understanding-regex.R
## %######################################################%##
# #
#### 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"
View ggplotly-barras-rotuladas.r
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(
@luisDVA
luisDVA / dog-ranks-2020.R
Created May 13, 2020
Dog popularity bump chart
View dog-ranks-2020.R
# 2020 (2019) AKC dog bump chart
library(ggplot2) # CRAN v3.3.0
library(ggbump) # CRAN v0.1.0
library(dplyr) # [github::tidyverse/dplyr] v0.8.99.9003
library(tidyr) # CRAN v1.0.3
library(ggimage) # CRAN v0.2.8
library(scico) # CRAN v1.1.0
library(extrafont) # CRAN v0.17
# make dataset