Publications by David Nilsson
Apply 2
Import and Clean Data ikea <- read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-11-03/ikea.csv') ## New names: ## Rows: 3694 Columns: 14 ## ── Column specification ## ────────────────────────────────────────────...
222 sym 4 img 4 tbl
Code Along 2
Goal: to predict the rental prices in the SF rental market Click here for the data. Import Data rent <- read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-07-05/rent.csv') ## Rows: 200796 Columns: 17 ## ── Column specification ────────────────────────�...
317 sym R (36927 sym/27 pcs) 4 img 3 tbl
Apply 1
Import and Clean Data ikea <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-11-03/ikea.csv') ## New names: ## Rows: 3694 Columns: 14 ## ── Column specification ## ─────────────────────────────────────────�...
299 sym 6 img 4 tbl
Code Along 1
Goal: to predict the rental prices in the SF rental market Click here for the data. Import Data rent <- read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-07-05/rent.csv') ## Rows: 200796 Columns: 17 ## ── Column specification ────────────────────────�...
310 sym 4 img 3 tbl
Apply 12
Import your data data("mtcars") mtcars <- as_tibble(mtcars) 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.187500 230.721875 146.687500 3.596563 3.21725...
458 sym Python (10265 sym/47 pcs) 2 img
Code Along 12
Ch20 Vectors 1 Introduction 2 Vector basics 3 Important types of atomic vector 4 Using atomic vectors sample(10) + 10 ## [1] 18 19 17 13 15 16 20 11 14 12 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...
360 sym Python (2236 sym/52 pcs)
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...
546 sym 4 tbl
Code Along 11
Ch19 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 =TRUE)) df$b...
186 sym
Apply 10
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 ...
300 sym 3 img
Code Along 10
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 ...
395 sym 3 img