Running examples in 'tidyquant-Ex.R' failed
The error most likely occurred in:

> ### Name: coord_x_date
> ### Title: Zoom in on plot regions using date ranges or date-time ranges
> ### Aliases: coord_x_date coord_x_datetime
> 
> ### ** Examples
> 
> # Load libraries
> library(tidyquant)
> library(dplyr)

######################### Warning from 'xts' package ##########################
#                                                                             #
# The dplyr lag() function breaks how base R's lag() function is supposed to  #
# work, which breaks lag(my_xts). Calls to lag(my_xts) that you type or       #
# source() into this session won't work correctly.                            #
#                                                                             #
# Use stats::lag() to make sure you're not using dplyr::lag(), or you can add #
# conflictRules('dplyr', exclude = 'lag') to your .Rprofile to stop           #
# dplyr from breaking base R's lag() function.                                #
#                                                                             #
# Code in packages is not affected. It's protected by R's namespace mechanism #
# Set `options(xts.warn_dplyr_breaks_lag = FALSE)` to suppress this warning.  #
#                                                                             #
###############################################################################

Attaching package: 'dplyr'

The following objects are masked from 'package:xts':

    first, last

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

> library(ggplot2)
> 
> # coord_x_date
> AAPL <- tq_get("AAPL", from = "2013-01-01", to = "2016-12-31")
Warning: x = 'AAPL', get = 'stock.prices': Error in getSymbols.yahoo(Symbols = "AAPL", env = <environment>, verbose = FALSE, : Unable to import "AAPL".
Timeout was reached: [query2.finance.yahoo.com] Resolving timed out after 10006 milliseconds

> AAPL %>%
+     ggplot(aes(x = date, y = adjusted)) +
+     geom_line() +                         # Plot stock price
+     geom_ma(n = 50) +                     # Plot 50-day Moving Average
+     geom_ma(n = 200, color = "red") +     # Plot 200-day Moving Average
+     # Zoom in
+     coord_x_date(xlim = c("2016-01-01", "2016-12-31"))
Error in `fortify()`:
! `data` must be a <data.frame>, or an object coercible by `fortify()`,
  not `NA`.
Backtrace:
    ▆
 1. ├─AAPL %>% ggplot(aes(x = date, y = adjusted))
 2. ├─ggplot2::ggplot(., aes(x = date, y = adjusted))
 3. └─ggplot2:::ggplot.default(., aes(x = date, y = adjusted))
 4.   ├─ggplot2::fortify(data, ...)
 5.   └─ggplot2:::fortify.default(data, ...)
 6.     └─cli::cli_abort(msg)
 7.       └─rlang::abort(...)
Execution halted