Publications by Daniel Lee
Document
Chapter 15 Introduction 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�...
414 sym Python (7863 sym/50 pcs) 5 img
Document
CHapter 15 Introduction 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�...
437 sym 4 img
Document
Import your data data <- read_excel("../00_data/myData.xlsx") ## New names: ## • `` -> `...1` data ## # A tibble: 4,810 × 24 ## ...1 rank position hand player years total…¹ status yr_st…² season age ## <dbl> <dbl> <chr> <chr> <chr> <chr> <dbl> <chr> <dbl> <chr> <dbl> ## 1 1 1 C Left Wayne G… 19...
293 sym 2 img
Document
# Load packages # Core library(tidyverse) library(tidyquant) Functions 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 = T...
270 sym R (2493 sym/25 pcs)
Document
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_...
420 sym 4 tbl
Document
title: “CodeAnalog10” author: “Jak Jallah” date: “2023-01-17” output: html_document editor_options: chunk_output_type: console — Introduction When should you write a function # For reproducable work set.seed(1234) # Create a Data frame df <- tibble::tibble( a = rnorm(10), b = rnorm(10), c = rnorm(10), d = rnorm(10)) # Res...
310 sym
Document
Import Data # excel file Chocolate <- read_excel("Chocolate.xlsx") Chocolate ## # A tibble: 191 × 10 ## Ref manufa…¹ locat…² revie…³ count…⁴ speci…⁵ cocoa…⁶ ingre…⁷ most_…⁸ rating ## <dbl> <chr> <chr> <dbl> <chr> <chr> <dbl> <chr> <chr> <dbl> ## 1 2454 5150 U.S.A. 2019 Tanzan… Ko...
536 sym 4 tbl
NFL Attendance
Import data TidyTuesday NHL # excel file NHL <- read_csv("../00_data/NHL_attendance.csv") ## Rows: 10846 Columns: 8 ## ── Column specification ──────────────────────────────────────────────────────── ## Delimiter: "," ## chr (2)...
227 sym 2 img
Document
Chapter 20 Introduction Vector Basics Important types of atomic vector Using Atomic Vectors sample(10) + 10 ## [1] 14 16 13 15 20 18 19 17 12 11 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 11 # data_...
303 sym Python (1366 sym/36 pcs)
Document
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.217250...
358 sym 1 img