sdmx(...) "TSconnect"(
q, dbname, user="", password = "", host="", ...) "TSget"(
serIDs, con, TSrepresentation = options()$TSrepresentation,
tf = NULL, start = tfstart(tf), end = tfend(tf), names=serIDs,
quiet = TRUE, ...) "TSdates"(
serIDs, con, vintage=NULL, panel=NULL, ... ) "TSdescription"(x, con, ... ) "TSdoc"(x, con, ... ) "TSlabel"(x, con, ... ) "TSsource"(x, con, ... )
q
is a database connection object.TSget
in package TSdbi.)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.
getSDMX
,
TSdates
,
TSget
,
tfwindow
,
require("TSsdmx")
require("tfplot")
## Not run:
# oecd <- TSconnect("sdmx", dbname="OECD")
# x <- TSget('G20_PRICES.CAN.CPALTT01.IXOB.M',oecd)
# tfplot(x)
# ## End(Not run)
Run the code above in your browser using DataLab