Learn R Programming

fame (version 1.13)

lowLevelFame: Low Level Fame Interface Functions

Description

These are most of the lower level functions used in the FAME interface. Most users will never need any of these functions, as the higher level function getfame and putfame do almost everything they want to do. The functions documented here were written in the course of implementing getfame and putfame, and some of them may prove useful on their own.

fameRunning answers TRUE if there is a process called "FAME SERVER" already running under the user's id and with the current R process as its parent process.

fameStart initializes the FAME HLI and opens a work database. Since the work database is always the first one opened, its key is always 0.

fameStop kills the HLI session and the FAME SERVER process started by fameStart. In any given R session, you cannot restart the HLI once it has died for any reason. (This is a FAME limitation, not an Rone.) Death of the R process also kills the child FAME SERVER process. So it rarely makes sense to call fameStop explicitly, as it makes any subsequent FAME interaction in the current R session impossible.

fameCommand sends its string argument to the child FAME SERVER process to be executed. If silent is TRUE, it invisibly returns a status code that can be sent to fameStatusMessage to get an error message. If silent is FALSE, the status message is echoed to standard output. If capture is TRUE, output from the FAME output channel is returned, with a "status" attribute holding the FAME status code.

fameStatusMessage looks up and returns the error message associated with its argument.

fameDbOpen opens the named database in the given access mode. It returns an integer dbKey, which is a required argument for some of the other functions documented here.

fameDbClose closes the database associated with the given dbKey.

fameDeleteObject deletes a named object from a database.

fameWriteSeries writes the tis (Time Indexed Series) object ser as fname in the database associated with dbKey. If an object by that name already exists in the database and update is TRUE, the frequency and type of ser are checked for consistency with the existing object, and if checkBasisAndObserved is TRUE (not the default), those items are also checked. Any inconsistencies cause the update to fail. If all checks are OK, then the range covered by ser is written to the database. If update if FALSE, any existing series called fname in the database will be replaced by ser. This function should probably not be called directly, as putfame provides a nicer interface.

fameWhat returns a list of low level information about an object in a database, including components named status, dbKey, name, class, type, freq, basis, observ, fyear, fprd, lyear, lprd, obs, and range. If getDoc is TRUE, it will also include description and documentation components. See the FAME documentation for the CHLI functions cfmwhat and cfmsrng for details.

Usage

fameRunning()
fameStart()
fameStop()
fameCommand(string, silent = T, capture = F)
fameStatusMessage(code)
fameDbOpen(dbName, accessMode = "read")
fameDbClose(dbKey)
fameDeleteObject(db, fname)
fameWriteSeries(dbKey, fname, ser, update = F, checkBasisAndObserved = F)
fameWhat(dbKey, fname, getDoc = F)

Arguments

string
a FAME command to be executed
silent
run the command quietly if TRUE
capture
capture and return strings from the FAME output channel if TRUE
code
an integer status code from FAME
dbName
name of or path to the database to open
accessMode
a string specifying the access model to open the database in: one of "read", "create", "overwrite", "update", or "shared".
dbKey
integer returned by dbOpen
db
can take dbKey or dbName form; that is, it can be an integer returned by dbOpen, or it can be the name of a database or path to a database.
fname
name of an object in a FAME database
ser
a tis time series
update
if TRUE update any existing series by the same name in place. If FALSE, replace existing series.
checkBasisAndObserved
see description above for fameWriteSeries
getDoc
if TRUE, also return the description and documentation attributes.

Value

  • fameRunning return a Boolean.

    fameStart and fameStop return nothing.

    If capture is FALSE, fameCommand invisibly returns a status code. If capture is TRUE, strings sent to the FAME output channel are returned as a character vector, and the status code is returned as the "status" attribute of that vector. fameStatusMessage returns a message string.

    fameDbOpen returns an integer dbKey.

    fameDbClose returns a status code.

    fameDeleteObject returns a status code.

    fameWriteSeries returns a status code.

    fameWhat returns a list.

See Also

getfame, putfame, fameCustomization