Publications by Reed Wilson
Module 6: Apply 5
Import data # excel file airlines <- read_excel("../00_data/MyData.xlsx") %>% mutate(n_events = as.numeric(n_events)) %>% mutate(avail_seat_km_per_week = as.numeric(avail_seat_km_per_week)) airlines ## # A tibble: 336 × 6 ## Ref airline avail_seat_km_per_week year_range type_…¹ n_eve…² ## <dbl> <chr> ...
198 sym Python (9736 sym/22 pcs)
Code Along 5: CH4
Coding basics R as a calculator 1000 / 10 ## [1] 100 x <- 1000 / 10 # x assignment symbol What’s in a name? Calling functions Use of TAB seq(from = 1, to = 10, by = 1) ## [1] 1 2 3 4 5 6 7 8 9 10 continuation character, + seq(from = 1, to = 10) ## [1] 1 2 3 4 5 6 7 8 9 10 Printing to screen y <- seq(from = 1, to = 10) y...
171 sym Python (229 sym/9 pcs)
Code Along 5: CH5
Import data flights ## # A tibble: 336,776 × 19 ## year month day dep_time sched_de…¹ dep_d…² arr_t…³ sched…⁴ arr_d…⁵ carrier ## <int> <int> <int> <int> <int> <dbl> <int> <int> <dbl> <chr> ## 1 2013 1 1 517 515 2 830 819 11 UA ## 2 2013 1 1 533...
523 sym Python (20904 sym/51 pcs) 1 img
Week 6: Code Along 5
# Load packages # Core library(tidyverse) library(tidyquant) Goal Collect individual returns into a portfolio by assigning a weight to each stock five stocks: “SPY”, “EFA”, “IJS”, “EEM”, “AGG” from 2012-12-31 to 2017-12-31 1 Import stock prices symbols <- c("SPY", "EFA", "IJS", "EEM", "AGG") prices <- tq_get(x = symbols, ...
353 sym R (2672 sym/14 pcs) 3 img
Week 6: Apply 5
# Load packages # Core library(tidyverse) library(tidyquant) Goal Collect individual returns into a portfolio by assigning a weight to each stock Choose your stocks. “MSFT”, “GOOG” from 2012-12-31 to 2017-12-31 1 Import stock prices symbols <- c("MSFT", "GOOG") prices <- tq_get(x = symbols, get = "stock.prices", ...
957 sym R (1942 sym/12 pcs) 1 img
Module 5: Apply 4
Import data State one question The more available seats km per week, the more events occurred. Plot data ### Use slice_max function to separate top 10 for type of event slice_max( .data, order_by, …, n, prop, by = NULL, with_ties = TRUE, na_rm = FALSE Interpret...
275 sym 1 img
Module 5: Code Along 4
Welcome Ch1 Introduction The data science project workflow Prerequisites R RStudio r packages Install the tidyverse package Running R code 1+2 ## [1] 3 Getting help Google Stackoverflow Ch2 Introduction to Data Exploration Ch3 Data Visualization Set up library(tidyverse) data mpg ## # A tibble: 234 × 11 ## manufacturer model di...
1384 sym R (1998 sym/15 pcs) 10 img
Week 5: Apply 4
1 Import stock prices of your choice 2 Convert prices to returns by quarterly ## # A tibble: 72 × 3 ## asset date returns ## <chr> <date> <dbl> ## 1 GOOG 2017-03-31 0.0538 ## 2 GOOG 2017-06-30 0.0912 ## 3 GOOG 2017-09-29 0.0540 ## 4 GOOG 2017-12-29 0.0871 ## 5 GOOG 2018-03-29 -0.0141 ## 6 GOOG 2018-06-29 0.0781 ...
372 sym 1 img
Week 5: Code Along 4
# Load packages # Core library(tidyverse) ## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ── ## ✔ ggplot2 3.4.1 ✔ purrr 1.0.1 ## ✔ tibble 3.1.8 ✔ dplyr 1.1.0 ## ✔ tidyr 1.3.0 ✔ stringr 1.5.0 ## ✔ r...
216 sym R (2770 sym/8 pcs) 1 img
Week 4: Code Along 3
# Load the Packages library(tidyverse) ## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ── ## ✔ ggplot2 3.3.6 ✔ purrr 0.3.4 ## ✔ tibble 3.1.8 ✔ dplyr 1.0.10 ## ✔ tidyr 1.2.1 ✔ stringr 1.4.1 ## ✔...
141 sym R (4195 sym/12 pcs)