Publications by Mackenzie Labrie
Apply 5
Import data # excel file data <- read_excel("../00_data/myData_charts.xlsx", sheet = "myData", skip = 1) ## New names: ## • `` -> `...1` data ## # A tibble: 195 × 18 ## ...1 Breed Affec…¹ Good …² Good …³ Shedd…⁴ Coat …⁵ Drool…⁶ Coat …⁷ Coat …⁸ ## <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl...
99 sym Python (7827 sym/15 pcs)
Code Along 6 CH7
#Introduction #Question2 #Variations Visulizing distributions diamonds %>% ggplot(aes(x = cut)) + geom_bar() diamonds %>% ggplot(mapping = aes(x = carat)) + geom_histogram(binwidth = 0.5) diamonds %>% filter(carat < 3) %>% ggplot(aes(x = carat)) + geom_histogram(binwidth = 0.5) diamonds %>% ggplot(aes(x = car...
281 sym R (1745 sym/18 pcs) 15 img
Apply it to your data 6
Import data # excel file data <- read_excel("../00_data/myData_charts.xlsx", sheet = "myData", skip = 1) ## New names: ## • `` -> `...1` data ## # A tibble: 195 × 18 ## ...1 Breed Affec…¹ Good …² Good …³ Shedd…⁴ Coat …⁵ Drool…⁶ Coat …⁷ Coat …⁸ ## <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl...
279 sym 4 img
Code Along 7
##Tidy Data ##Pivoting long to wide form table4a_long <- table4a %>% pivot_longer(cols = c(`1999`, `2000`), names_to = "year", values_to = "cases") wide to long form table4a_long %>% pivot_wider(names_from = year, values_from = cases) ## # A tibble: 3 × 3 ## country `1999` `...
180 sym Python (2625 sym/16 pcs)
Apply7
Import your data data <- read.csv("../00_data/myData.csv") Pivoting long to wide form wide to long form data_wide <- data %>% pivot_wider(names_from = yearpublished, values_from = owned) Separating and Uniting Separate a column data_sep <- data %>% separate(col = playingtime, into = c("minplayers", "maxplayers")) ##...
160 sym Python (490 sym/5 pcs)
Code Along 8 Ch13
Introduction nycflights13 Keys Mutating joins inner joins x <- tribble( ~key, ~val_x, 1, "x1", 2, "x2", 3, "x3" ) y <- tribble( ~key, ~val_y, 1, "y1", 2, "y2", 4, "y3" ) inner_join(x, y) ## Joining, by = "key" ## # A tibble: 2 × 3 ## key val_x val_y ## <dbl> <chr> <chr> ## 1 1 x1 y1 ## 2 ...
205 sym Python (5346 sym/42 pcs)
Code Along 8 Ch14
Introduction String basics chat_data <- "I'm 'very' hungry." chat_data2 <-'I am "very" hungry.' stringr::str_length("I am hungry.") ## [1] 12 stringr::str_c(c("I", "am"), collapse = "") ## [1] "Iam" stringr::str_c("I", "am", sep = ";") ## [1] "I;am" stringr::str_sort(c("John", "Mary", "Aaron")) ## [1] "Aaron" "John" "Mary" Matching patterns ...
365 sym
Apply 8
Import your data data <- read.csv("../00_data/myData.csv") %>% as_tibble() Chapter 13 What are primary keys in your data? Primary keys in my data are minplayers, maxplayers, playingtime, yearpiblished, owned, and id. Can you divide your data into two? Divide it using dplyr::select in a way the two have a common variable, which you could use to...
484 sym
Code Along 9 Ch15&16
CH15 Factors General social summary gss_cat ## # A tibble: 21,483 × 9 ## year marital age race rincome partyid relig denom tvhours ## <int> <fct> <int> <fct> <fct> <fct> <fct> <fct> <int> ## 1 2000 Never married 26 White $8000 to 9999 Ind,near … Prot… Sout… 12 ## 2 2000 Divorc...
440 sym Python (8528 sym/49 pcs) 4 img
Apply9
Import your data myData <- read.csv("../00_data/boardgames_details.csv") data_small <- myData %>% select(primary, yearpublished, minplayers) %>% filter(primary %in% c("Robin Hood", "Chaos", "Pandemic", "Azul")) Chapter 15 Create a factor data_small %>% distinct(primary) %>% filter(primary %in% c("Robin Hood", "Chaos", "Pandemic", "...
450 sym 2 img