Description Usage Arguments Details

View source: R/calculate_return.R

Calculate arithmetic or log returns at specified periods.

1 2 | ```
calculate_return(.tbl_time, ..., type = "arithmetic", period = "daily",
start_date = NULL, suffix = "return")
``` |

`.tbl_time` |
A |

`...` |
The columns to calculate returns for. One or more unquoted column names separated by commas. |

`type` |
Either |

`period` |
A character specification used for time-based grouping. The
general format to use is Note that you can pass the specification in a flexible way: 1 Year: `'1 year'` /`'1 Y'` /`'1 yearly'` /`'yearly'`
This shorthand is available for year, quarter, month, day, hour, minute, second, millisecond and microsecond periodicities. Additionally, you have the option of passing in a vector of dates to use as custom and more flexible boundaries. |

`start_date` |
Optional argument used to specify the start date for the first group. The default is to start at the closest period boundary below the minimum date in the supplied index. |

`suffix` |
For each column specified in |

These functions make no attempt to ensure that you have a full period in your return calculations. This means that if you calculate monthly returns from daily returns but you do not have a complete month of returns for your first month, you may get a value that does not make much sense. It is up to the user to keep this in mind!

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.