combine_time_series: Combine multiple time-series into one data.frame

Description Usage Arguments Details Examples

View source: R/TimeSeriesUtility.R

Description

Combine multiple time-series into one data.frame

Usage

1
2
3
4
5
6
7
8
9
combine_time_series(
  ...,
  freq,
  trunc_start = TRUE,
  trunc_end = TRUE,
  data_type = c("ret", "price"),
  fill_NA = TRUE,
  input_list = FALSE
)

Arguments

...

time-series to combine

freq

character to represent desired frequency

trunc_start

boolean to truncate at latest inception

trunc_end

boolean to truncate at earliest ending date

data_type

string to specify time-series being combined as returns or prices

fill_NA

boolean to fill missing values, FALSE leaves NAs

input_list

boolean to specify if returns are being entered in list form

Details

This workflow is set up to combine returns or prices. If you have mixed data you'll need to convert to returns or prices before combining. If you are combining return or price data.frames leave the input_list parameter set to FALSE. Otherwise if your return data.frames have already been combined into a list you can pass the list through ..., and set input_list to TRUE. The freq parameter allows you to change the frequency of all the returns to the specified freq.

Examples

1
2
3
4
5
data(ETF)
ret_a <- ret[, 1:2]
ret_b <- ret[, c(1, 3)]
ret_c <- ret[, c(1, 4)]
combo_ret <- combine_time_series(ret_a, ret_b, ret_c, freq = 'd')

alejandro-sotolongo/InvestmentSuite documentation built on Jan. 19, 2020, 5:20 p.m.