Publications by Sondre Asheim

Apply12

25.04.2024

Import your data data("mtcars") skimr::skim(mtcars) Data summary Name mtcars Number of rows 32 Number of columns 11 _______________________ Column type frequency: numeric 11 ________________________ Group variables None Variable type: numeric skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist mpg 0 1 20.09 6.03 10.4...

391 sym 2 img 2 tbl

Code_along11

14.04.2024

Ch 19 Functions Introduction When should you write a function? # For reproducible work set.seed(1234) # Create a data frame df <- tibble::tibble( a = rnorm(10), b = rnorm(10), c = rnorm(10), d = rnorm(10) ) # Rescale each column df$a <- (df$a - min(df$a, na.rm = TRUE)) / (max(df$a, na.rm = TRUE) - min(df$a, na.rm =...

294 sym

Apply11

14.04.2024

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...

532 sym 4 tbl

Code_along12

14.04.2024

Ch20 Vectors 1 Introduction 2 Vector basics 3 Important types of atomic vector 4 Using atomic vectors sample(10) + 10 ## [1] 20 12 11 14 13 16 17 19 15 18 1:10 + 1:2 ## [1] 2 4 4 6 6 8 8 10 10 12 1:10 + 1:3 ## 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 1...

358 sym Python (2234 sym/52 pcs)

Apply10

11.04.2024

Import your data Data <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-11-29/wcmatches.csv') ## Rows: 900 Columns: 15 ## ── Column specification ────────────────────────────────────────────────�...

297 sym 3 img

Code_along10

08.04.2024

Ch15 Factors Creating factors General Social Survey 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 ...

396 sym 3 img

Apply9

04.04.2024

Import your data Data <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-11-29/wcmatches.csv') ## Rows: 900 Columns: 15 ## ── Column specification ────────────────────────────────────────────────�...

112 sym

Code_along9

31.03.2024

Introduction String basics chac_data <- "I'm '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" str_sort(c("John", "Mary", "Aaron")) ## [1] "Aaron" "John" "Mary" Matching patterns with regular expressions flights %>% glimpse...

362 sym

Apply8

29.03.2024

1. Import your data Import two related datasets from TidyTuesday Project. World_cup_matches <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-11-29/wcmatches.csv') ## Rows: 900 Columns: 15 ## ── Column specification ─────────────────────────...

1630 sym

CodeAlong8

25.03.2024

Introduction nycflights13 Keys Mutating joins Inner join x <- tribble( ~key, ~val_x, 1, "x1", 2, "x2", 3, "x3" ) y <- tribble( ~key, ~val_y, 1, "y1", 2, "y2", 3, "y3" ) inner_join(x, y) ## Joining with `by = join_by(key)` ## # A tibble: 3 × 3 ## key val_x val_y ## <db...

206 sym Python (5449 sym/43 pcs)