Publications by Daniel Lee
Company Analysis
# Load packages # Core library(tidyverse) library(tidyquant) library(gt) Import Stock prices symbols <- c("KO","^GSPC") # Get stocks using tq_get prices <- tq_get(x = symbols, get = "stock.prices", from = "2014-01-01", to = "2024-10-10") Calculate Cumulative Percentage Gain prices <- p...
8225 sym R (10068 sym/23 pcs) 2 img 2 tbl
Code Along 7 DA
# Load packages # Core library(tidyverse) Tidy data Pivoting long to wide form table4a_long <- table4a %>% pivot_longer(cols = c('1999', '2000'), names_to = "year", values_to = "cases") wide to long form table4a_long %>% pivot_wider(names_from = year, values_from = cases) ## # A tib...
182 sym R (2803 sym/17 pcs)
Code Along 6
Goal: to predict attrition, emplyees who are likely to leave the company. Import Data 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 ## ✔ ggp...
726 sym R (20861 sym/30 pcs) 3 img 3 tbl
Code Along 7
# Load packages # Core library(tidyverse) library(tidyquant) Goal Measure portfolio risk using skewness. Skewness is the extent to which returns are asymmetric around the mean. It is important because a positively skewed distribution means large positive returns are more likely while a negatively skewed distribution implies large negative ...
612 sym R (4588 sym/17 pcs) 3 img
Document
# 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= symbo...
401 sym R (4246 sym/21 pcs) 2 img
Applyit7
# Load packages # Core library(tidyverse) library(tidyquant) Goal Visualize and compare skewness of your portfolio and its assets. Choose your stocks. from 2012-12-31 to 2017-12-31 1 Import stock prices symbols <- c("AAPL", "MSFT", "TSLA", "JNJ", "AMZN") prices <- tq_get(x = symbols, get = "stock.prices", ...
1305 sym R (3081 sym/18 pcs) 1 img
Apply 7
# Load packages # Core library(tidyverse) library(tidyquant) Goal Visualize and compare skewness of your portfolio and its assets. Choose your stocks. from 2012-12-31 to 2017-12-31 1 Import stock prices symbol <- c("NVDA", "SIRI", "AAPL", "MCD") prices <- tq_get(x = symbol, get = "stock.prices", from = "2012-12...
718 sym R (1942 sym/12 pcs) 1 img
Code Along 7
# 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 symbol <- c("SPY", "EFA", "IJS", "EEM", "AGG") prices <- tq_get(x = symbol, ...
424 sym R (3955 sym/17 pcs) 3 img
Apply6
Import data olympics <- read_excel("../00_data/myData_apply2.xlsx") olympics ## # 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 1952…...
303 sym R (5058 sym/26 pcs) 12 img
Code along 7
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", ...
170 sym Python (3959 sym/22 pcs)