My code is as below, it crashes my RStudio in 2 of 4 trials. Not sure what is going on.
require(tidyquant)
aapl_prices <- tq_get("AAPL", get = "stock.prices", from = " 1990-01-01")
aapl_daily_returns <- aapl_prices %>%
tq_transmute(select = adjusted,
mutate_fun = periodReturn,
period = "daily",
type = "arithmetic")
aapl_monthly_returns <- aapl_prices %>%
tq_transmute(select = adjusted,
mutate_fun = periodReturn,
period = "monthly",
type = "arithmetic")
aapl_weekly_returns <- aapl_prices %>%
tq_transmute(select = adjusted,
mutate_fun = periodReturn,
period = "weekly",
type = "arithmetic")
ggplot(aes( x = daily.returns), data = aapl_daily_returns) +
geom_histogram(fill = "blue")
ggplot(aes( x = weekly.returns), data = aapl_weekly_returns) +
geom_histogram(fill = "blue")
ggplot(aes( x = monthly.returns), data = aapl_monthly_returns) +
geom_histogram(fill = "blue")