Publications by Daniel Lee
Code Along 1
Welcome Ch1 Introduction The data science project workflow Prerequisites R RStudio r packages Install the tidyverse package Running R code Getting help Google Stackoverflow Ch2 Introduction to Data Exploration Ch3 Data Visualization Set up library(tidyverse) data mpg ## # A tibble: 234 × 11 ## manufacturer model displ year ...
1376 sym R (1688 sym/9 pcs) 6 img
Apply Your Data
Import stock prices stocks <- tq_get(c("JNJ", "DKNG"), get = "stock.prices", from = "2016-01-01", to = "2019-01-01") ## Warning: x = 'DKNG', get = 'stock.prices': Error in getSymbols.yahoo(Symbols = "DKNG", env = <environment>, verbose = FALSE, : Unable to import "DKNG". ## DKNG download fail...
52 sym Python (1355 sym/5 pcs) 1 img
Document
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...
171 sym Python (231 sym/9 pcs)
Document
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 ...
331 sym Python (19276 sym/46 pcs)
Document
Import stock prices stocks <- tq_get(c("JNJ", "AAPL"), get = "stock.prices", from = "2016-01-01", to = "2019-01-01") stocks ## # A tibble: 1,508 × 8 ## symbol date open high low close volume adjusted ## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 JN...
146 sym Python (5296 sym/15 pcs) 1 img
Document
# Load Packages library(tidyverse) # core functions ## ── 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 ✔ st...
59 sym R (2054 sym/8 pcs) 3 img
Document
# Load 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 ## ...
119 sym R (2124 sym/15 pcs)
Document
Important Takeaways Reproducible finance tells you about how to do quantitative, data science driven driven financial analysis. The book says that a code should tell a story when read by a human just like how it is read by the computer. There are three different universes for portfolio analysis for R. Data visualization is when numbers are t...
385 sym
Document
# Load Packages library(tidyverse) library(tidyquant) `## Get stock prices and convert to returns Ra <- c("TSLA", "VZ") %>% tq_get(get = "stock.prices", from = "2022-01-01") %>% group_by(symbol) %>% tq_transmute(select = adjusted, mutate_fun = periodReturn, period = "mont...
198 sym R (3624 sym/11 pcs)
Document
# Load packages # Core 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....
217 sym R (2904 sym/8 pcs) 1 img