Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with tq_performance function #252

Closed
mbanco opened this issue Jan 2, 2025 · 1 comment
Closed

Error with tq_performance function #252

mbanco opened this issue Jan 2, 2025 · 1 comment

Comments

@mbanco
Copy link

mbanco commented Jan 2, 2025

Hi,
This is the error that occurs with the latest version of the 'PerformanceAnalytics' package, version 2.0.8:

library(dplyr)

Ra <- FANG %>%

  • group_by(symbol) %>%
    
  • tq_transmute(adjusted, periodReturn, period = "monthly", col_rename = "Ra")
    

Rb <- "^GSPC" %>%

  • tq_get(get  = "stock.prices",
    
  •        from = "2010-01-01",
    
  •        to   = "2015-12-31") %>%
    
  • tq_transmute(adjusted, periodReturn, period = "monthly", col_rename = "Rb")
    

RaRb <- left_join(Ra, Rb, by = c("date" = "date"))
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
Run rlang::last_trace() to see where the error occurred.

Best regards,

Mauricio

@mdancho84
Copy link
Collaborator

Looks like this is happening due to a new dependency that is not being automatically loaded with PerformanceAnalytics. RobStatTM is now required. I've added this as a dependency to Tidyquant. Try out the development version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants