the course website. Please submit what you have on Opportunity Zones by Thursday at 5pm. 1. FRONT MATTER ANNOUNCEMENTS Next Week: Lab-05 (from last week), Lab-06 (from today), final project check-in Two Weeks: PS-03 (from today), Lab-07 (from next week), video lectures over spring break
▸ Are variables stored in the format that makes the most sense for their data? ▸ Do variables represent one and only one construct? ▸ Is there a unique identification variable? ▸ Is there missing or incomplete data? 4. DATA WRANGLING A B VARIABLES
need to be subset into tables with different observational units? ▸ Are there duplicate observations? ▸ Are there “near” duplicate observations? 4. DATA WRANGLING A B OBSERVATIONS
data wrangling functions ▸ dplyr for data wrangling functions ▸ naniar for missing data analyses ▸ stringr for detecting patterns in string data 4. DATA WRANGLING PACKAGES
identifying missing data id a b c NA NA NA miss_var_summary(data) #> # A tibble: 4 x 3 #> variable n_miss pct_miss #> <chr> <int> <dbl> #> 1 c 2 50.0 #> 2 d 1 24.0 #> 3 id 0 0 #> 4 a 0 0
identifying duplicates id a b c 1 high 24 TRUE 1 high 24 TRUE 2 low 67 FALSE 3 low 89 TRUE > get_dupes(data) No variable names specified - using all columns. # A tibble: 2 x 5 id a b c dupe_count <dbl> <chr> <dbl> <lgl> <int> 1 1 high 24 TRUE 2 2 1 high 24 TRUE 2
identifying duplicates id a b c 1 high 24 TRUE 1 high 24 TRUE 2 low 67 FALSE 3 low 89 TRUE > get_dupes(data, id) # A tibble: 2 x 5 id dupe_count a b c <dbl> <int> <chr> <dbl> <lgl> 1 1 2 high 24 TRUE 2 1 2 high 24 TRUE
used for reordering columns id a b c 1 high 24 TRUE 1 high 24 TRUE 2 low 67 FALSE 3 low 89 TRUE id c a b 1 TRUE high 24 1 TRUE high 24 2 FALSE low 67 3 TRUE low 89
for creating new variables id a b c 1 high 24 TRUE 1 high 24 TRUE 2 low 67 FALSE 3 low 89 TRUE id a b c d 1 high 24 TRUE TRUE 1 high 24 TRUE TRUE 2 low 67 FALSE FALSE 3 low 89 TRUE FALSE
with mutate() to search within strings id name b c 1 Highland Creek 24 TRUE 1 Highland Creek 24 TRUE 2 Lost River 67 FALSE 3 Highland River 89 TRUE id name b c d 1 Highland Creek 24 TRUE TRUE 1 Highland Creek 24 TRUE TRUE 2 Lost River 67 FALSE FALSE 3 Highland River 89 TRUE TRUE
to re-order observations id name b c 1 Highland Creek 24 TRUE 1 Highland Creek 24 TRUE 2 Lost River 67 FALSE 3 Highland River 89 TRUE id name b c 3 Highland River 89 TRUE 2 Lost River 67 FALSE 1 Highland Creek 24 TRUE 1 Highland Creek 24 TRUE
to create groups that can be summarized id name b c 1 Highland Creek 24 TRUE 1 Highland Creek 24 TRUE 2 Lost River 67 FALSE 3 Highland Creek 89 TRUE id name b c 1 Highland Creek 24 TRUE 1 Highland Creek 24 TRUE 3 Highland Creek 89 TRUE id name b c 2 Lost River 67 FALSE
to then summarize grouped data id name b c 1 Highland Creek 24 TRUE 1 Highland Creek 24 TRUE 2 Lost River 67 FALSE 3 Highland Creek 89 TRUE name n mean_b Highland Creek 3 77.6 Lost River 1 67
forthcoming Next Week: PS-02 (from last few weeks), Lab-06 (from today) Two Weeks: PS-03 (from today), Lab-07 (from next week), final project check-in, video lectures over spring break