Get time series matrix structure from a database
1 2 3 4 5
A database connection.
identifiers for series to extract.
Arguments passed to other methods. See details.
These functions extract data from
a database using a connection. This method is generic.
serIDs should give identifiers for the series to extract.
TSget and other functions also provide a way to query a regularly
used database by setting the connection in
options(TSconnection=con), so then only the series identifiers
need to be specified in calls to
The user can specify a default time series representation with the argument
default, but might be
"zoo", "its", "timeSeries" or a function which is
used to coerce the series to any representation.
TSrepresentation is passed in the ... argument.
TSrepresentation is a function it will be applied directly to the
default returned by the query. The default is usually
ts for monthly,
quarterly, annual, and semi-annual data, and
zoo otherwise, but the
default may be different for some
TSget methods. The conversion is
done with the function
The user should attach any package necessary for dealing with the representation.
TSrepresentation is not specified, or is specified as
then for SQL packages (TSMySQL, TSPostgreSQL , TSSQLite, etc)
ts representation is used for data from tables
"A", "Q", "M","S" and
zoo otherwise. See
TSput for a
list of the various tables. For other packages the default is generally the same,
zoo for all series, but this may vary.
It would be possible to specify
TSrepresentation="as.zoo", but this may
as.zoo being applied twice, in which case some information
about the time representation gets lost, so the best way to get a
represenation is to specify
Users can set a session default with
so that this is always passed as an argument to
It is also possible to pass start, end, or tframe information to truncate the
returned series. This is part of the ... argument passed
tfwindow for more details. By
default no truncation is applied.
If the database supports vintages or panels then it is also possible to set
defaults for these with, for example,
options(TSpanel="Canada"). The default specification has to be supported
by the database for this to work.
Also, if the database supports vintages or panels it is possible to give a
vector value for one of
panel as long as
serIDs is length
1. (That is, only one of
panel can have more than one element.)
In this case, if
names is not specified,
will be used for the series names in the returned time series matrix.
TSlabel can also be specified as arguments.
(Passed in ...).
A time series matrix.