Learn R Programming

TSfame (version 2015.4-1)

TSfameMethods: TSdbi fame Methods

Description

Methods for TSdbi fame time series database connection.

Usage

fameLocal(...) fameServer(...) "TSconnect"(q, dbname, accessMode = if (file.exists(dbname)) "shared" else "create", current = NA, ...) "TSconnect"(q, dbname, service = "", host = "", user = "", password = "", current = NA, ...)
"TSget"(serIDs, con, TSrepresentation = getOption("TSrepresentation"), tf = NULL, start = tfstart(tf), end = tfend(tf), names = NULL, TSdescription = FALSE, TSdoc = FALSE, TSlabel=FALSE, TSsource=TRUE, vintage=getOption("TSvintage"), ...) "TSget"(serIDs, con, TSrepresentation = getOption("TSrepresentation"), tf = NULL, start = tfstart(tf), end = tfend(tf), names = NULL, TSdescription = FALSE, TSdoc = FALSE, TSlabel=FALSE, TSsource=TRUE, vintage=getOption("TSvintage"), ...)
"TSput"(x, serIDs=seriesNames(x), con, TSdescription.=TSdescription(x), TSdoc.=TSdoc(x), TSlabel.=NULL, TSsource.=NULL, warn = TRUE, ...) "TSput"(x, serIDs=seriesNames(x), con, TSdescription.=TSdescription(x), TSdoc.=TSdoc(x), TSlabel.=NULL, TSsource.=NULL, warn = TRUE, ...)
"TSdates"(serIDs, con, vintage=getOption("TSvintage"), panel=NULL, ...) "TSdates"(serIDs, con, vintage=getOption("TSvintage"), panel=NULL, ...)
"TSexists"( serIDs, con, vintage=NULL, panel=NULL, ...) "TSexists"( serIDs, con, vintage=NULL, panel=NULL, ...)
"TSdelete"(serIDs, con, vintage=getOption("TSvintage"), panel=getOption("TSpanel"), ...) "TSdelete"(serIDs, con, vintage=getOption("TSvintage"), panel=getOption("TSpanel"), ...)
"TSdescription"(x, con, ...) "TSdescription"(x, con, ...)
"TSdoc"(x, con, ...) "TSdoc"(x, con, ...)
"TSlabel"(x, con, ...) "TSlabel"(x, con, ...)
"TSsource"(x, con, ...) "TSsource"(x, con, ...)
"TSvintages"(con) "TSvintages"(con)

Arguments

q
A character string indicating the query interface to use, or a database connection object.
dbname
The name of the [server and] database to which the connection should be established, omitted if q is a database connection object.
con
A database connection.
serIDs
identifiers for series to extract.
vintage
character string indicating vintage of the series on the databases.
panel
character string indicating panel of the series on the database (not supported by this database).
x
data series to put on the database, or a series identifier for TSdescription and TSdoc or, for print, a database connection as returned by TSconnect.
TSrepresentation
time series representation to use for the result.
names
Optional character vector to use for series names. Defaults to serIDs unless vintage is a vector, in which case it defaults to vintage.
tf
Optional tframe to use for truncating data. (See tfwindow.)
start
Optional start date to use for truncating data. (See tfwindow.)
end
Optional end date to use for truncating data. (See tfwindow.)
TSdescription
TRUE or FALSE indicating whether description should be extracted
TSdescription.
Description to put on the database.
TSdoc
TRUE or FALSE indicating whether documentation should be extracted.
TSdoc.
Documentation to put on the database.
TSlabel
For compatibility with other TS packages. Not supported in Fame
TSlabel.
For compatibility with other TS packages. Not supported in Fame
TSsource
For compatibility with other TS packages. Not supported in Fame
TSsource.
For compatibility with other TS packages. Not supported in Fame
warn
Logical indicating if warning messages should be suppressed.
accessMode
Optional character indicating the mode to use when opening the Fame database when establishing the first connection. After the first connection, "read" will be used for reading and "update" for writing.
host
A character string indicating a server.
service
A character string indicating a server port number.
user
A character string indicating a user id (if needed).
password
A character string indicating a password (if needed).
current
A character string indicating a vintage that should be considered the current vintage (see details).
...
Arguments passed to other methods.

Value

Details

These are fame methods for TSdbi. See the package TSdbi for details and see the vignette distributed with this package for more complete examples.

This package provides a wrapper to the fame package to provide a TSdbi API for users. The TSfameLocalConnection establishes a connection using the locally fame which can access local databases or databases on a remote server, specified by the server name followed by a space and the database name. The TSfameServerConnection establishes a connection to a remote server using one of Fame's remote server protocols. See package fame for more specific details.

There is a simplistic mechanism for accessing vintages of data stored in different Fame databases. To use this, the dbname argument to TSconnect should be a vector of character strings indicating the databases, with names of the elements indicating the vintages. The vintage argument to TSget is then a character vector used to select a subset of dbname. The dbname argument to TSconnect can also be specified to indicate the version that should be considered current. (That is, the user needs to know that information and specify it, rather than having it supplied by the database.) In other respects the vintages support is then similar to other TSdbi packages such as TSMySQL, and examples in those packages may be useful. Some examples are also provided in the TSfame Guide vingette.

See Also

TSdbi-package, dbConnect, TSput getfame

Examples

Run this code
   require("tfplot")
   con <- try(TSconnect(dbDriver("fame"), dbname="test.db"))
    if(! inherits(con, "try-error")) {
      z <- ts(rnorm(100), start=c(1975,1), frequency=12)
      seriesNames(z) <- "random1"
      if(TSexists("random1", con)) TSreplace(z, con) else
      TSput(z, con)
      z1 <- TSget("random1", con)
      tfplot(z1)
      z <- ts(matrix(rnorm(100),50,2), start=c(1975,1), frequency=4)
      seriesNames(z) <- c("random2","random3")
      if(TSexists("random2", con) |
         TSexists("random3", con) ) TSreplace(z, con) else
      TSput(z, con)
      z2 <- TSget("random2", con)
      tfplot(z2)
      TSdates("D1", con)
      TSdates("random2", con)
      TSdates(c("random1","random2","random3"), con)
      TSmeta("random2", con)
      options(TSconnection=con)
      z2 <- TSget(c("random2","random3"))
      z <- TSdates(c("D1","random2","random3"))
      print(z)
      TSmeta("random2")
      TSdelete("random1", con)
      TSdelete("random2")
      dbDisconnect(con)
      }

Run the code above in your browser using DataLab