to_weekly: Function to convert from daily to weekly returns.

View source: R/to_weekly.R

to_weeklyR Documentation

Function to convert from daily to weekly returns.

Description

to_weekly will convert daily returns to weekly returns, while allowing the user flexibility in the choice of which day to end the week.

Usage

to_weekly(
  daily,
  days_in_week = 5,
  week_ending_day_str = c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
    "Saturday", "Sunday")
)

Arguments

daily

An xts object of daily returns.

days_in_week

Default 5.

week_ending_day_str

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.

Details

These will be added.

Value

returns

Examples

args(to_weekly)


PCRA documentation built on July 15, 2026, 9:06 a.m.