This provides a safe way to do portfolio return calculations.
It ensures the returns and weights are explicitly mapped.
It is thus a simple wrapper to PerformanceAnalytics::Return.portfolio making it safer.
See the following gist for a discussion on why this safety feature is essential: https://gist.github.com/Nicktz/a24ba1775d41aab85919c505ca1b9a0c

Safe_Return.portfolio(R, weights, lag_weights = TRUE, ...)

## Arguments

R |
xts of returns. |

weights |
xts weights. |

lag_weights |
This function makes weights effective on the day it is given. The Return.Portfolio function defaults to having weights become effective only the following day after its specification. E.g. from the vignette:
Rebalancing periods can be thought of as taking effect immediately after the close of the bar. So, a March 31 rebalancing date will actually be in effect for April 1. |

... |
parameter inputs from PerformanceAnalytics::Return.portfolio. |

## Examples

#> Warning: package 'PerformanceAnalytics' was built under R version 3.6.1

#> Loading required package: xts

#> Loading required package: zoo

#> Warning: package 'zoo' was built under R version 3.6.1

#>
#> Attaching package: 'zoo'

#> The following objects are masked from 'package:base':
#>
#> as.Date, as.Date.numeric

#>
#> Attaching package: 'PerformanceAnalytics'

#> The following object is masked from 'package:graphics':
#>
#> legend