Publications by Dayton Chandonnet

Quiz2

04.03.2020

# Load packages library(tidyquant) library(tidyverse) # Import stock prices stock_prices <- tq_get(c("WMT", "TGT", "AMZN"), get = "stock.prices", from = "2020-01-01") # Calculate daily returns stock_returns <- stock_prices %>% group_by(symbol) %>% tq_mutate(select = adjusted, mutate_fun = periodReturn, period = "daily") stock_retur...

1761 sym R (2665 sym/9 pcs) 4 img

Quiz2-c

02.03.2020

In this exercise you will learn to plot data using the ggplot2 package. To answer the questions below, use Chapter 4.3 Categorical vs. Quantitative Data Visualization with R. Q1 Plot the distribution of daily returns by stock using kernel density plots. Hint: See the code in 4.3.2 Grouped kernel density plots. Q2 Plot the distribution of daily...

1341 sym 5 img

Introduction to ggplot2

02.03.2020

In this exercise you will learn to plot data using the ggplot2 package. To answer the questions below, use Chapter 4.3 Categorical vs. Quantitative Data Visualization with R. # Load packages library(tidyquant) library(tidyverse) # Import stock prices stock_prices <- tq_get(c("AAPL", "MSFT"), get = "stock.prices", from = "2020-01-01") stock_pr...

1096 sym R (2738 sym/11 pcs) 7 img

Clean data

19.02.2020

In this exercise you will learn to clean data using the dplyr package. To this end, you will follow through the codes in one of our e-texts, Data Visualization with R. The given example code below is from Chapter 1.2 Cleaning data. ## # A tibble: 87 x 13 ## name height mass hair_color skin_color eye_color birth_year gender ## <chr> <int>...

906 sym R (2890 sym/7 pcs)

Quiz 1

10.02.2020

Use the given code below to answer the questions. Q1 Import Netflix stock prices, instead of Apple. Q2 How many shares of the stock were traded on January 13, 2017? 10,515,000 shares of Netflix stock were traded on January 13, 2017. Q3 Stock prices in this data would be a good example of numeric data. Character and logical are two other basic...

1865 sym R (283 sym/1 pcs) 3 img

Mock Quiz 1

05.02.2020

Use the given code below to answer the questions. Q1 Get Walmart stock prices, instead of Apple. Hint: Insert a new code chunk below and type in the code, using the tq_get() function above. Replace the ticker symbol for Walmart. You may find the ticker symbol for Microsoft from Yahoo Finance. ## # A tibble: 1,029 x 7 ## date open high...

1665 sym R (760 sym/1 pcs) 1 img