Learn R Programming

quantspec (version 1.2-4)

timeSeriesValidator: Validates if Y is of an appropriate type and converts to a numeric.

Description

Checks whether Y is either

  • numeric,

  • a ts object, or

  • a zoo object.

If not, an error is returned. If it is one of the three the data is returned as a numeric.

Usage

timeSeriesValidator(Y)

Value

Returns the time series as a matrix.

Arguments

Y

the time series to be validated.

Examples

Run this code
Y <- timeSeriesValidator(sp500)
Y <- timeSeriesValidator(wheatprices)
Y <- timeSeriesValidator(rnorm(10))
if (FALSE) Y <- timeSeriesValidator("Not a valid input")

Run the code above in your browser using DataLab