Fred {fImport} | R Documentation |
A collection and description of functions to import
financial and economic market data from the Fred
Website.
The functions are:
fredImport | time series from St. Louis FRED Web site, |
fredSeries | easy to use download from St. Louis FRED |
fredImport(query, file = "tempfile", source = "http://research.stlouisfed.org/fred2/series/", frequency = "daily", save = FALSE, sep = ";", try = TRUE) fredSeries(query = "DPRIME", frequency = "daily", returnClass = c("timeSeries", "ts", "matrix", "data.frame"), getReturns = FALSE, ...)
getReturns |
a logical flag. Should return values be computed using the
function returnSeries ?
|
file |
a character string with filename, usually having extension ".csv", where to save the downloaded data. |
frequency |
a character string, one of "quarterly", "monthly", or "daily", defining the frequency of the data records. |
query |
a character string, denoting the location of the data at the web site. |
returnClass |
a character string naming the class of the object to be
returned. By default the function returns
a "timeSeries" object, alternatives are: "ts" ,
"matrix" , or "data.frame" .
|
save |
a logical value, if set to TRUE the downloaded data file will
be stored under the path and file name specified by the
string file . By default FALSE.
|
sep |
a character value, defining the field separator for the destination file which saves the downloaded data records. By default a semicolon. |
source |
a character string with the download URL. |
try |
a logical value, if set to TRUE the Internet access will be checked. |
... |
optional arguments to be passed. |
The function fredImport
returns an S4 object of class
fWEBDATA
with the following slots:
@call |
the function call. |
@data |
the data as downloaded formatted as a data.frame. |
@param |
a character vector whose elements contain the values of selected parameters of the argument list. |
@title |
a character string with the name of the download. This can be overwritten specifying a user defined input argument. |
@description |
a character string with an optional user defined description. By default just the current date when the test was applied will be returned. |
The function fredSeries
returns an S4 object of
class timeSeries
or alternatively an object specified by
the function argument returnClass
.
Internet Download Functions:
IMPORTANT NOTE: If the service provider changes the data file format
it may become necessary to modify and update the functions.
Diethelm Wuertz for the Rmetrics R-port.
## Not run: ## fredImport - DPRIME = fredImport("DPRIME") if (!is.null(DPRIME)) print(DPRIME@data[1:20, ]) ## End(Not run)