Publications by Daniel Lee

Document

30.09.2024

# Load packages # Core library(tidyverse) ## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ── ## ✔ dplyr 1.1.4 ✔ readr 2.1.5 ## ✔ forcats 1.0.0 ✔ stringr 1.5.1 ## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1 ## ✔ lubridate 1.9...

217 sym R (3112 sym/8 pcs) 1 img

CodeAlong5

30.09.2024

# 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 = symb...

352 sym R (2689 sym/14 pcs) 3 img

Code Along 4

30.09.2024

This template offers an opinionated guide on how to structure a modeling analysis. Your individual modeling analysis may require you to add to, subtract from, or otherwise change this structure, but consider this a general framework to start from. If you want to learn more about using tidymodels, check out our Getting Started guide. In this example...

2961 sym R (201108 sym/1128 pcs) 4 img

Code along 5 part 1

29.09.2024

Coding basics R as a calculator 1000 / 10 ## [1] 100 x <- 1000 / 10 x ## [1] 100 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, ...

172 sym Python (238 sym/10 pcs)

Code along 5 assignment

29.09.2024

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

351 sym R (2635 sym/14 pcs) 3 img

Code along 5 part 2

29.09.2024

Import data flights ## # A tibble: 336,776 × 19 ## year month day dep_time sched_dep_time dep_delay arr_time sched_arr_time ## <int> <int> <int> <int> <int> <dbl> <int> <int> ## 1 2013 1 1 517 515 2 830 819 ## 2 2013 1 1 533 529 ...

538 sym Python (21732 sym/62 pcs) 3 img

Apply 4

25.09.2024

1 Import stock prices of your choice 2 Convert prices to returns by quarterly ## # A tibble: 112 × 3 ## asset date returns ## <chr> <date> <dbl> ## 1 JPM 2017-03-31 0.0125 ## 2 JPM 2017-06-30 0.0455 ## 3 JPM 2017-09-29 0.0495 ## 4 JPM 2017-12-29 0.119 ## 5 JPM 2018-03-29 0.0331 ## 6 JPM 2018-06-29 -0.0488...

450 sym 1 img

Apply 4

26.09.2024

1 Import stock prices of your choice 2 Convert prices to returns by quarterly ## # A tibble: 80 × 3 ## asset date returns ## <chr> <date> <dbl> ## 1 ALK 2012-03-30 -0.0317 ## 2 ALK 2012-06-29 0.00223 ## 3 ALK 2012-09-28 -0.0237 ## 4 ALK 2012-12-31 0.206 ## 5 ALK 2013-03-28 0.395 ## 6 ALK 2013-06-28 -...

371 sym 1 img

Which of your stock beat the market in 2022?

26.09.2024

# Load packages library(tidyverse) library(tidyquant) 1 Import stock prices of your choice # Choose Stocks symbols <- c("AMZ","TSLA","AAPL","CMG","NKE") prices <- tq_get(x= symbols, get ="stock.prices", from = "2012-01-01", to = "2017-01-01") ## 2 Convert prices to returns by ***quarte...

641 sym R (1283 sym/6 pcs) 1 img

Apply 4

26.09.2024

Import data # excel file data <- read_excel("../00_data/myData_apply2.xlsx") data ## # A tibble: 271,116 × 16 ## Column1 id name sex age height weight team noc games year season ## <dbl> <dbl> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <chr> ## 1 270479 135289 Zzim… M 20 NA NA Braz… BRA 19...

661 sym 1 img