Publications by David Nilsson

Apply 9

04.04.2024

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

1429 sym

Code Along 9

02.04.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] "I am" 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 %>% gl...

362 sym

Apply 8

28.03.2024

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

1099 sym

Code Along 8

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", 4, "y3" ) inner_join(x, y) ## Joining with `by = join_by(key)` ## # A tibble: 2 × 3 ## key val_x val_y ## <dbl> <chr> <chr> ## 1 ...

205 sym Python (5429 sym/43 pcs)

Apply 7

21.03.2024

Import your data data <- read_excel("../00_data/myData.xlsx") data ## # A tibble: 900 × 15 ## year country city stage home_team away_team home_score away_score outcome ## <dbl> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl> <chr> ## 1 1930 Uruguay Montev… Grou… France Mexico 4 1 H ...

167 sym Python (7485 sym/12 pcs)

Code Along 7

19.03.2024

Tidy data Pivoting long to wide form table4a ## # A tibble: 3 × 3 ## country `1999` `2000` ## <chr> <dbl> <dbl> ## 1 Afghanistan 745 2666 ## 2 Brazil 37737 80488 ## 3 China 212258 213766 table4a_long <- table4a %>% pivot_longer(cols = c('1999', '2000'), names_to = "year", ...

186 sym Python (3931 sym/22 pcs)

Code Along 6 Ch 6

29.02.2024

Introduction Queation2 Variation Visualizing 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...

313 sym R (1857 sym/19 pcs) 15 img

Apply 5

29.02.2024

Import data # excel file data <- read_excel("../00_data/myData.xlsx") data ## # A tibble: 900 × 15 ## year country city stage home_team away_team home_score away_score outcome ## <dbl> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl> <chr> ## 1 1930 Uruguay Montev… Grou… France Mexico 4 ...

165 sym Python (7113 sym/12 pcs)

Apply 6

29.02.2024

Introduction Questions Variation Visualizing distributions ggplot(data = data) + geom_bar(mapping = aes(x = year)) data %>% count(year) ## # A tibble: 21 × 2 ## year n ## <dbl> <int> ## 1 1930 18 ## 2 1934 17 ## 3 1938 18 ## 4 1950 22 ## 5 1954 26 ## 6 1958 35 ## 7 1962 32 ## 8 ...

261 sym 3 img

Apply 5

29.02.2024

Import data # excel file data <- read_excel("../00_data/myData.xlsx") data ## # A tibble: 900 × 15 ## year country city stage home_team away_team home_score away_score outcome ## <dbl> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl> <chr> ## 1 1930 Uruguay Montev… Grou… France Mexico 4 ...

159 sym Python (4565 sym/6 pcs)