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 regex-04_regex-data-cleaningyt1.R
## %######################################################%##
# #
#### Regex for data cleaning 1 - your turn ####
# #
## %######################################################%##
# After running the code below:
library(ggplot2)
library(dplyr)
View regex-03_regex-data-cleaningyt.R
##%######################################################%##
# #
#### Regex in R - Your Turn ####
# #
##%######################################################%##
# Match the following regular expressions against the test vector below using `str_detect`.
## Can you explain the matches?
View restructuring-04_coalesce-and-fill.R
## %######################################################%##
# #
#### Coalesce and Fill - Your Turn ####
# #
## %######################################################%##
# Load the fish landings data 'fish-landings.csv'
# Fill the 'Fish' and 'Lake' columns
# Reorder the numeric variables ('Comission reported total' first)
# create a new column, coalescing the three numeric variables
View restructuring-03_pivoting.R
## %######################################################%##
# #
#### Pivoting Data - Your Turn ####
# #
## %######################################################%##
# Load the dog ranks data ("dogranks_your.csv")
# Pivot the data (wide to long and back to wide)
# load packages -----------------------------------------------------------
@luisDVA
luisDVA / restructuring-02_dplyr-across.R
Created Jan 2, 2021
Working with columns using across
View restructuring-02_dplyr-across.R
## %######################################################%##
# #
#### Working with columns with 'across' - Your Turn ####
# #
## %######################################################%##
# Load the midwest data bundled with ggplot2
# Keep only rows for Ohio (OH)
# Subset the 'county' column and all columns that match the string 'pop' (hint: use a selection helper)
# Square-root transform all numeric variables
View restructuring-01_useful-dplyr-functions.R
## %######################################################%##
# #
#### Useful dplyr functions - your turn ####
# #
## %######################################################%##
# Load the mammal sleep data bundled with ggplot2
# Select "name" and "conservation" columns and those that include the string 'sleep' in their name
# Create a new column that contains the values of 'sleep_total' multiplied by 3
@luisDVA
luisDVA / common-issues-10_aoe-demo.R
Last active Jan 12, 2021
Putting everything together
View common-issues-10_aoe-demo.R
## %######################################################%##
# #
#### 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
View common-issues-09_parsing-numbers.R
## %######################################################%##
# #
#### 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
View common-issues-08_empty-rows-columns.R
## %######################################################%##
# #
#### 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
View common-issues-07_broken-values.R
## %######################################################%##
# #
#### 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'