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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: tq_performance
> ### Title: Computes a wide variety of summary performance metrics from
> ###   stock or portfolio returns
> ### Aliases: tq_performance tq_performance_ tq_performance_fun_options
> 
> ### ** Examples
> 
> # Load libraries
> 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

> 
> # Use FANG data set
> 
> # Get returns for individual stock components grouped by symbol
> Ra <- FANG %>%
+     group_by(symbol) %>%
+     tq_transmute(adjusted, periodReturn, period = "monthly", col_rename = "Ra")
> 
> # Get returns for SP500 as baseline
> Rb <- "^GSPC" %>%
+     tq_get(get  = "stock.prices",
+            from = "2010-01-01",
+            to   = "2015-12-31") %>%
+     tq_transmute(adjusted, periodReturn, period = "monthly", col_rename = "Rb")
> 
> # Merge stock returns with baseline
> RaRb <- left_join(Ra, Rb, by = c("date" = "date"))
> 
> ##### Performance Metrics #####
> 
> # View options
> tq_performance_fun_options()
$table.funs
 [1] "table.AnnualizedReturns" "table.Arbitrary"        
 [3] "table.Autocorrelation"   "table.CAPM"             
 [5] "table.CaptureRatios"     "table.Correlation"      
 [7] "table.Distributions"     "table.DownsideRisk"     
 [9] "table.DownsideRiskRatio" "table.DrawdownsRatio"   
[11] "table.HigherMoments"     "table.InformationRatio" 
[13] "table.RollingPeriods"    "table.SFM"              
[15] "table.SpecificRisk"      "table.Stats"            
[17] "table.TrailingPeriods"   "table.UpDownRatios"     
[19] "table.Variability"      

$CAPM.funs
 [1] "CAPM.alpha"       "CAPM.beta"        "CAPM.beta.bear"   "CAPM.beta.bull"  
 [5] "CAPM.CML"         "CAPM.CML.slope"   "CAPM.dynamic"     "CAPM.epsilon"    
 [9] "CAPM.jensenAlpha" "CAPM.RiskPremium" "CAPM.SML.slope"   "TimingRatio"     
[13] "MarketTiming"    

$SFM.funs
[1] "SFM.alpha"       "SFM.beta"        "SFM.CML"         "SFM.CML.slope"  
[5] "SFM.dynamic"     "SFM.epsilon"     "SFM.jensenAlpha"

$descriptive.funs
[1] "mean"           "sd"             "min"            "max"           
[5] "cor"            "mean.geometric" "mean.stderr"    "mean.LCL"      
[9] "mean.UCL"      

$annualized.funs
[1] "Return.annualized"        "Return.annualized.excess"
[3] "sd.annualized"            "SharpeRatio.annualized"  

$VaR.funs
[1] "VaR"  "ES"   "ETL"  "CDD"  "CVaR"

$moment.funs
 [1] "var"              "cov"              "skewness"         "kurtosis"        
 [5] "CoVariance"       "CoSkewness"       "CoSkewnessMatrix" "CoKurtosis"      
 [9] "CoKurtosisMatrix" "M3.MM"            "M4.MM"            "BetaCoVariance"  
[13] "BetaCoSkewness"   "BetaCoKurtosis"  

$drawdown.funs
[1] "AverageDrawdown"   "AverageLength"     "AverageRecovery"  
[4] "DrawdownDeviation" "DrawdownPeak"      "maxDrawdown"      

$Bacon.risk.funs
[1] "MeanAbsoluteDeviation" "Frequency"             "SharpeRatio"          
[4] "MSquared"              "MSquaredExcess"        "HurstIndex"           

$Bacon.regression.funs
 [1] "CAPM.alpha"       "CAPM.beta"        "CAPM.epsilon"     "CAPM.jensenAlpha"
 [5] "SystematicRisk"   "SpecificRisk"     "TotalRisk"        "TreynorRatio"    
 [9] "AppraisalRatio"   "FamaBeta"         "Selectivity"      "NetSelectivity"  

$Bacon.relative.risk.funs
[1] "ActivePremium"    "ActiveReturn"     "TrackingError"    "InformationRatio"

$Bacon.drawdown.funs
[1] "PainIndex"     "PainRatio"     "CalmarRatio"   "SterlingRatio"
[5] "BurkeRatio"    "MartinRatio"   "UlcerIndex"   

$Bacon.downside.risk.funs
 [1] "DownsideDeviation"     "DownsidePotential"     "DownsideFrequency"    
 [4] "SemiDeviation"         "SemiVariance"          "UpsideRisk"           
 [7] "UpsidePotentialRatio"  "UpsideFrequency"       "BernardoLedoitRatio"  
[10] "DRatio"                "Omega"                 "OmegaSharpeRatio"     
[13] "OmegaExcessReturn"     "SortinoRatio"          "M2Sortino"            
[16] "Kappa"                 "VolatilitySkewness"    "AdjustedSharpeRatio"  
[19] "SkewnessKurtosisRatio" "ProspectRatio"        

$misc.funs
[1] "KellyRatio"   "Modigliani"   "UpDownRatios"

> 
> # Get performance metrics
> RaRb %>%
+     tq_performance(Ra = Ra, performance_fun = SharpeRatio, p = 0.95)
# A tibble: 4 × 5
# Groups:   symbol [4]
  symbol `ESSharpe(Rf=0%,p=95%)` SemiSDSharpe(Rf=0%,p=9…¹ StdDevSharpe(Rf=0%,p…²
  <chr>                    <dbl>                    <dbl>                  <dbl>
1 META                     0.193                    0.424                  0.345
2 AMZN                     0.215                    0.339                  0.314
3 NFLX                     0.199                    0.438                  0.355
4 GOOG                     0.213                    0.354                  0.296
# ℹ abbreviated names: ¹​`SemiSDSharpe(Rf=0%,p=95%)`,
#   ²​`StdDevSharpe(Rf=0%,p=95%)`
# ℹ 1 more variable: `VaRSharpe(Rf=0%,p=95%)` <dbl>
> 
> RaRb %>%
+     tq_performance(Ra = Ra, Rb = Rb, performance_fun = table.CAPM)
Error in `dplyr::mutate()`:
ℹ In argument: `nested.col = purrr::map(...)`.
ℹ In group 1: `symbol = "AMZN"`.
Caused by error in `purrr::map()`:
ℹ In index: 1.
Caused by error in `.coefficients()`:
! "package:RobStatTM" %in% search() || requireNamespace("RobStatTM",  .... is not TRUE
Backtrace:
     ▆
  1. ├─RaRb %>% tq_performance(Ra = Ra, Rb = Rb, performance_fun = table.CAPM)
  2. ├─tidyquant::tq_performance(., Ra = Ra, Rb = Rb, performance_fun = table.CAPM)
  3. │ ├─tidyquant::tq_performance_(...)
  4. │ └─tidyquant:::tq_performance_.grouped_df(...)
  5. │   └─... %>% dplyr::group_by_at(.vars = group_names)
  6. ├─dplyr::group_by_at(., .vars = group_names)
  7. │ └─dplyr:::manip_at(...)
  8. │   └─dplyr:::tbl_at_syms(...)
  9. │     └─dplyr:::tbl_at_vars(...)
 10. │       └─dplyr::tbl_vars(tbl)
 11. │         ├─dplyr:::new_sel_vars(tbl_vars_dispatch(x), group_vars(x))
 12. │         │ └─base::structure(...)
 13. │         └─dplyr:::tbl_vars_dispatch(x)
 14. ├─tidyr::unnest(., cols = nested.col)
 15. ├─dplyr::select(., -"data")
 16. ├─dplyr::mutate(...)
 17. ├─dplyr:::mutate.data.frame(...)
 18. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), by)
 19. │   ├─base::withCallingHandlers(...)
 20. │   └─dplyr:::mutate_col(dots[[i]], data, mask, new_columns)
 21. │     └─mask$eval_all_mutate(quo)
 22. │       └─dplyr (local) eval()
 23. ├─purrr::map(...)
 24. │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
 25. │   ├─purrr:::with_indexed_errors(...)
 26. │   │ └─base::withCallingHandlers(...)
 27. │   ├─purrr:::call_with_cleanup(...)
 28. │   └─tidyquant (local) .f(.x[[i]], ...)
 29. │     └─base::tryCatch(...)
 30. │       └─base (local) tryCatchList(expr, classes, parentenv, handlers)
 31. │         └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
 32. │           └─value[[3L]](cond)
 33. │             └─base::warning(e)
 34. │               └─base::withRestarts(...)
 35. │                 └─base (local) withOneRestart(expr, restarts[[1L]])
 36. │                   └─base (local) doWithOneRestart(return(expr), restart)
 37. └─purrr (local) `<fn>`(`<smplErrr>`)
 38.   └─cli::cli_abort(...)
 39.     └─rlang::abort(...)
Execution halted
Examples with CPU (user + system) or elapsed time > 5s
              user system elapsed
coord_x_date 3.255  0.241   5.298