TSdbiMethods: TSdbi fame Methods

Description Usage Arguments Details Value See Also Examples

Description

Methods for TSdbi fame time series database connection.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
   fameLocal(...)
   fameServer(...)
   ## S4 method for signature 'TSfameLocalConnection,missing'
TSconnect(q, dbname, 
	accessMode = if (file.exists(dbname)) "shared" else "create", 
	current = NA, ...)
    ## S4 method for signature 'TSfameServerConnection,missing'
TSconnect(q, dbname, 
        service = "", host = "", user = "", password = "", current = NA, ...)

    ## S4 method for signature 'character,TSfameLocalConnection'
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"),   ...)
    ## S4 method for signature 'character,TSfameServerConnection'
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"),   ...)

    ## S4 method for signature 'ANY,character,TSfameLocalConnection'
TSput(x, serIDs=seriesNames(x), 
	con, TSdescription.=TSdescription(x), 
	TSdoc.=TSdoc(x), TSlabel.=NULL, TSsource.=NULL, warn = TRUE, ...)
    ## S4 method for signature 'ANY,character,TSfameServerConnection'
TSput(x, serIDs=seriesNames(x), 
	con, TSdescription.=TSdescription(x), 
	TSdoc.=TSdoc(x), TSlabel.=NULL, TSsource.=NULL, warn = TRUE, ...)

    ## S4 method for signature 'character,TSfameLocalConnection'
TSdates(serIDs, con, 
	vintage=getOption("TSvintage"), panel=NULL, ...)
    ## S4 method for signature 'character,TSfameServerConnection'
TSdates(serIDs, con, 
	vintage=getOption("TSvintage"), panel=NULL, ...)

    ## S4 method for signature 'character,TSfameLocalConnection'
TSexists(
	serIDs, con, vintage=NULL, panel=NULL, ...)
    ## S4 method for signature 'character,TSfameServerConnection'
TSexists(
	serIDs, con, vintage=NULL, panel=NULL, ...)

    ## S4 method for signature 'character,TSfameLocalConnection'
TSdelete(serIDs, con,  
            vintage=getOption("TSvintage"), panel=getOption("TSpanel"), ...)
    ## S4 method for signature 'character,TSfameServerConnection'
TSdelete(serIDs, con,  
            vintage=getOption("TSvintage"), panel=getOption("TSpanel"), ...)

    ## S4 method for signature 'character,TSfameLocalConnection'
TSdescription(x, con, ...)
    ## S4 method for signature 'character,TSfameServerConnection'
TSdescription(x, con, ...)

    ## S4 method for signature 'character,TSfameLocalConnection'
TSdoc(x, con, ...)
    ## S4 method for signature 'character,TSfameServerConnection'
TSdoc(x, con, ...)

    ## S4 method for signature 'character,TSfameLocalConnection'
TSlabel(x, con, ...)
    ## S4 method for signature 'character,TSfameServerConnection'
TSlabel(x, con, ...)

    ## S4 method for signature 'character,TSfameLocalConnection'
TSsource(x, con, ...)
    ## S4 method for signature 'character,TSfameServerConnection'
TSsource(x, con, ...)

    ## S4 method for signature 'TSfameLocalConnection'
TSvintages(con)
    ## S4 method for signature 'TSfameServerConnection'
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.

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.

Value

depends.

See Also

TSdbi-package, dbConnect, TSput getfame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
   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)
      }

Example output

Loading required package: TSdbi
Loading required package: tfplot
Loading required package: tframe
Error in dbDriver("fame") : could not find function "dbDriver"

TSfame documentation built on May 2, 2019, 6:50 p.m.

Related to TSdbiMethods in TSfame...