Description Usage Arguments Details Value See Also Examples
Get a time series (matrix) using SDMX, for example, from the OECD database.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | sdmx(...)
## S4 method for signature 'sdmxConnection,missing'
TSconnect(
q, dbname, user="", password = "", host="", ...)
## S4 method for signature 'character,TSsdmxConnection'
TSget(
serIDs, con, TSrepresentation = options()$TSrepresentation,
tf = NULL, start = tfstart(tf), end = tfend(tf), names=serIDs,
quiet = TRUE, ...)
## S4 method for signature 'character,TSsdmxConnection'
TSdates(
serIDs, con, vintage=NULL, panel=NULL, ... )
## S4 method for signature 'character,TSsdmxConnection'
TSdescription(x, con, ... )
## S4 method for signature 'character,TSsdmxConnection'
TSdoc(x, con, ... )
## S4 method for signature 'character,TSsdmxConnection'
TSlabel(x, con, ... )
## S4 method for signature 'character,TSsdmxConnection'
TSsource(x, con, ... )
|
q |
A character string indicating the query interface to use, or a database connection object. |
dbname |
The name of the database to which the connection should be
established, omitted if |
con |
a database connection object. |
serIDs |
identifiers for series on the database. |
vintage |
character string indicating vintage of the series on the database (not supported by this database). |
panel |
character string indicating panel of the series on the database (not supported by this database). |
x |
time series data(TSput), or identifiers for series on the database (TSdoc and TSdescription). |
names |
optional character vector to use for series names in the R object. See details. |
tf |
time frame for trimming data, passed to tfwindow. |
start |
time frame for trimming data, passed to tfwindow. |
end |
time frame for trimming data, passed to tfwindow. |
TSrepresentation |
time representation for returned series.
(See |
quiet |
logical to suppress progress report. |
user |
(unused) a character string indicating a user id. |
password |
(unused) a character string indicating a password. |
host |
(unused) a character string indicating a host computer. |
... |
Arguments passed to other methods or to sdmxCall. |
These functions interface to the SDMX databases such as the OECD web portal.
TSget
is a wrapper to RJSDMX::getSDMX
to provided an
interface that is consistent with TSdbi.
The TSdbi function argument serIds
is passed as the series to
return, and dbname
indicates the data provider (e.g. "OECD").
The SDMX query syntax allows for the possibility of indicating several series
by using +, |
and *
characters. For example,
'G20_PRICES.CAN+MEX.CPALTT01.IXOB.M'
would indicate Canada and Mexico,
while 'G20_PRICES.*.CPALTT01.IXOB.M'
would indicate all countries.
By default, TSget
will uses series names as returned by the SDMX call.
The argument names
can be used to replace names, but only in some
situations.
If *
is used in serIds
then names
will be ignored because
the number and order of the returned series cannot be guaranteed.
If +
or |
are used in more than one field then names
will be ignored.
If +
or |
are used in only one field then names
will applied, but this requires that TSget
sort the series in the
specified order since the SDMX call does not guarantee the return order.
(This may change, an enhancement request has been made.)
Thus, specifying serIds
as 'G20_PRICES.CAN+MEX.CPALTT01.IXOB.M'
or specifying it as c('G20_PRICES.CAN.CPALTT01.IXOB.M',
'G20_PRICES.MEX.CPALTT01.IXOB.M')
should return the same result, but the
mechanism is different. In the first case the getSdmx
call returns both
series and then the TSget
sorts the result into the proper order to
apply the names.
In the second case the TSget
code makes two separate calls to
getSdmx
.
The treatment of start
and end
dates also differs in a subtle
way depending on the specification. A character specification is assumed to be
an SDMX specification, so start="1990-Q1"
is passed unchanged as part of
the getSdmx
call whereas start=c(1990,1)
cannot detemine the
frequency, so uses getSdmx
to return the whole series, then truncates
at the appropriate start date.
(See TSget
in TSdbi for more details on TSget
.)
TSsdmx does not support writing data to the source.
The class TSsdmxConnection
extends class
DBIConnection
in the DBI package.
See the vignette in TSdata for additional examples.
When the TSsdmx method TSconnect
is first used the underlying code
reads a configuration file that sets, among other things, the
amount of printout done during retrieval. The default is useful for debugging
but will be more than typically expected in an R
session.
A system wide default location for this file can be set.
A user's default will be found in the users home directory (~/.SdmxClient in
Linux). More details on this file can be found at
https://github.com/amattioc/SDMX/wiki/Configuration. R
users will
probably want to specify SDMX.level = OFF
and
java.util.logging.ConsoleHandler.level = OFF
to suppress most printed output. Otherwise, R
programs that
use try()
will not suppress printed error messages as they should.
With the levels set OFF, the error and warning messages are still returned to
the R
to deal with as appropriate.
Depends.
getSDMX
,
TSdates
,
TSget
,
tfwindow
,
1 2 3 4 5 6 7 8 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.