weekly_return {StockDistFit} | R Documentation |
Compute Weekly Returns of a Vector.
Description
This function takes a numeric vector of asset returns and computes weekly returns.
Usage
weekly_return(vec)
Arguments
vec |
a numeric vector of asset returns. |
Value
A numeric vector of weekly returns.
Note
The input data must be an xts object with dates as rownames.
See Also
Examples
# Compute weekly returns of an asset vector
require(xts)
asset_returns_xts <- xts(c(29.2, 30.0, 36.2, 30.4, 38.5, -35.6, 34.5),
order.by = as.Date(c("2022-05-01", "2022-05-08", "2022-05-15",
"2022-05-22", "2022-05-29", "2022-06-05",
"2022-06-12")))
weekly_return(asset_returns_xts)
[Package StockDistFit version 1.0.0 Index]