Learn R Programming

TSsql (version 2017.4-1)

TSquery: Construct Time Series Data From a Database

Description

Construct a time series from a database

Usage

TSquery(select, dateField, table, where=NULL, frequency="monthly",
             na.as=0, names=NULL, con=options()$connection)

Arguments

select
character string used to construct query.
dateField
character string used to construct query.
table
character string used to construct query.
where
character string used to construct query.
frequency
character string used to specify frequency of the result (only "daily", "monthly" or "annual" are currently supported.
na.as
value to be used to replace NAs in the returned series.
names
optional vector of character strings to be used for the returned series. If not NULL it must have length equal to the number of series returned.
con
A database connection.

Value

A time series or time series matrix.

Details

This functions is unlike other functins in this package (and may eventually be moved to a separate package). It constructs a time series from a database (using a connection) and a query generated with the function arguments. An example query might be something like z<- TSquery(select="SUM(amount )", dateField="issue_date", table="term", where="term > 10", frequency="annual", con=con)

See Also

TSget,