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

Return.annualized should have na.omit argument, rather than disregarding NAs #172

Open
Ljupch0 opened this issue Apr 13, 2022 · 1 comment

Comments

@Ljupch0
Copy link

Ljupch0 commented Apr 13, 2022

It would be great if there is an option to control the treatment of NA, like in base functions mean and sum.

I would prefer if the following returned NA, rather than 0.1489125

Return.annualized(c(0.1, 0.2, NA), scale = 1)
@Ljupch0
Copy link
Author

Ljupch0 commented Apr 13, 2022

This wrapper also works, but just saying would be a good option to have by default.

Return.annualized.na <- function(vector, ...) {
   if (any(is.na(vector))) {
      return(NA)
   } else {
      PerformanceAnalytics::Return.annualized(R = vector, ...)
   }
}

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

1 participant