Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

buildData

Create Data Object for Modelling


Description

Create one data object from multiple sources, applying transformations via standard R formula mechanism.

Usage

buildData(formula, na.rm = TRUE, return.class = "zoo")

Arguments

formula

an object of class formula (or one that can be coerced to that class): a symbolic description of the desired output data object, with the dependent side corresponding to first column, and the independent parameters of the formula assigned to the remaining columns.

na.rm

drop rows with missing values?

return.class

one of "zoo","data.frame","ts","timeSeries"

Details

Makes available for use outside the quantmod workflow a dataset of appropriately transformed variables, using the same mechanism underlying specifyModel. Offers the ability to apply transformations to raw data using a common formula mechanism, without having to explicitly merge different data objects.

Interally calls specifyModel followed by modelData, with the returned object being coerced to the desired 'return.class' if possible, otherwise returns a zoo object.

See getSymbols and specifyModel for more information regarding proper usage.

Value

An object of class return.class.

Author(s)

Jeffrey A. Ryan

See Also

Examples

## Not run: 
  buildData(Next(OpCl(DIA)) ~ Lag(TBILL) + I(Lag(OpHi(DIA))^2))
  buildData(Next(OpCl(DIA)) ~ Lag(TBILL), na.rm=FALSE)
  buildData(Next(OpCl(DIA)) ~ Lag(TBILL), na.rm=FALSE, return.class="ts")

## End(Not run)

quantmod

Quantitative Financial Modelling Framework

v0.4.18
GPL-3
Authors
Jeffrey A. Ryan [aut, cph], Joshua M. Ulrich [cre, aut], Wouter Thielen [ctb], Paul Teetor [ctb], Steve Bronder [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.