to_weekly will convert daily returns to weekly returns, while allowing the user flexibility in the choice of which day to end the week.
to_weekly(
daily,
days_in_week = 5,
week_ending_day_str = c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
"Saturday", "Sunday")
)returns
An xts object of daily returns.
Default 5.
controls what is the week end day. If the week_ending_day is “Wednesday”, then Wednesday is the end of a week. It means the return from previous Thursday to current Wednesday will be included in current Wednesday week’s cumulative return. If the beginning of the dataset is before week_ending_day (in this case, Wednesday) , the first week’s return would be from the begining of the dataset to the first week_ending day. If the last week is short of the full week,i.e.if week_ending_day is ’’Friday” and 2015-12-31 is a Thursday, then the last four day return will be labeled as 2016-01-01.
These will be added.