Publications by rboynton2
apply 9
Import your data # excel file refugee <- read_excel("../00_data/mydata.xlsx") %>% janitor::clean_names() Chapter 14 Tools Detect matches refugee %>% summarise(sum(str_detect(the_year_of_data_collection, "8$"))) ## # A tibble: 1 × 1 ## `sum(str_detect(the_year_of_data_collection, "8$"))` ## ...
91 sym
Apply 10
Import your data # excel file refugee <- read_excel("../00_data/mydata.xlsx") %>% janitor::clean_names() Chapter 15 Create a factor Modify factor order refugees_by_country <- refugee %>% group_by(country_of_origin_name) %>% summarise( Num_of_refugees = mean(the_number_of_refugees, na.rm = TRUE) ) # Plot refugees_by_c...
192 sym 4 img
apply 12
Import your data # excel file refugee <- read_excel("../00_data/mydata.xlsx") %>% janitor::clean_names() Repeat the same operation over different columns of a data frame Case of numeric variables mtcars %>% map_dbl(.x = ., .f =~mean(x = .x)) ## mpg cyl disp hp drat wt qsec ## 20.090625 6.18750...
360 sym 1 img
apply 6
Import your data # excel file refugee <- read_excel("../00_data/mydata.xlsx") %>% janitor::clean_names() data ## function (..., list = character(), package = NULL, lib.loc = NULL, ## verbose = getOption("verbose"), envir = .GlobalEnv, overwrite = TRUE) ## { ## fileExt <- function(x) { ## db <- grepl("\\.[^.]+\\.(gz|bz2|xz)$...
306 sym R (9068 sym/6 pcs) 3 img
apply 7
Import your data # excel file refugee <- read_excel("../00_data/mydata.xlsx") %>% janitor::clean_names() data Pivoting long to wide form refugee ## # A tibble: 64,809 × 16 ## the_year_of_data_collection country_of_origin_name country_of_origin_un…¹ ## <dbl> <chr> <chr> ...
159 sym Python (10600 sym/16 pcs)
apply8
Import your data # excel file refugee <- read_excel("../00_data/mydata.xlsx") %>% janitor::clean_names() Chapter 13 What are primary keys in your data? Primary keys include the_number_of_refugees, the_number_of_asylum_seekers, the_number_of_returned_refugees, the_number_of_internally_displaced, the_number_of_others_of_concern_to_unhcr, the_n...
520 sym
Apply 11
Import your data data(flights) flights %>% skimr::skim() Data summary Name Piped data Number of rows 336776 Number of columns 19 _______________________ Column type frequency: character 4 numeric 14 POSIXct 1 ________________________ Group variables None Variable type: character skim_variable n_missing complete_rate min max empty n_u...
418 sym R (11176 sym/23 pcs) 4 tbl
Code along 12
Ch20 Vectors 1 Introduction 2 Vector basics 3 Important types of atomic vector 4 Using atomic vectors ## [1] 18 19 12 11 17 14 13 20 16 15 ## [1] 2 4 4 6 6 8 8 10 10 12 ## Warning in 1:10 + 1:3: longer object length is not a multiple of shorter object ## length ## [1] 2 4 6 5 7 9 8 10 12 11 ## a b ## 1 1 1 ## 2 2 2 ...
334 sym
CODE ALONG 11
Ch19 Functions Introduction When should you write a function? ## # A tibble: 10 × 4 ## a b c d ## <dbl> <dbl> <dbl> <dbl> ## 1 0.332 0.153 0.782 1 ## 2 0.765 0 0.473 0.519 ## 3 1 0.0651 0.498 0.448 ## 4 0 0.311 0.943 0.511 ## 5 0.809 0.573 0.373 0.168 ## 6 0.831 0.260 0 0.308 ## 7 ...
278 sym
CODE ALONG 8
Introduction nycflights13 Keys Mutating joins Inner join ## Joining with `by = join_by(key)` ## # A tibble: 2 × 3 ## key val_x val_y ## <dbl> <chr> <chr> ## 1 1 x1 y1 ## 2 2 x2 y2 Outer joins ## Joining with `by = join_by(key)` ## # A tibble: 3 × 3 ## key val_x val_y ## <dbl> <chr> <chr> ## 1 1 x1 y...
188 sym