fetch: Request factor time-series hosted on remote servers.

Description Usage Arguments Details Value

View source: R/fetch.R

Description

The function fetch returns the requested time-series represented by the handle string argument, which must be matched against an internal catalog. The catalog includes valid handles, their associated source url, and other fields required to send a valid query.

Usage

1
fetch(hdl_str = "", dest_dir = "")

Arguments

hdl_str

A string handle, representing the requested time-series. Call catalog_do(operation = "show") to see the list of valid handle parameters. See catalog_do() documentation for additional details. The function will stop and generate an error message if an invalid handle parameter is passed as an argument.

dest_dir

A string representing an existing directory, where all streams (archive files (e.g. .zip), audit files (.pdf), and uncompressed files (.txt, .csv)) will be stored. The function will stop and generate an error message if the directory does not exist. Note that three sub-directories will be created (if they do not exist): Archives, Audit and Uncompressed

Details

The string handle representing the requested time-series is matched in the internal catalog, which encodes and maintains the parameters required to perform each query (request) associated with a particular data set hosted on remote server.

The function currently supports two main sources of factor time-series, the Kenneth French Data Library (K. French Data Library) and the Federal Reserve of St. Louis (FRED St Louis). The first site relies on the FTP (file transfer protocol), a standard network protocol used for the transfer of computer files between a client and server . The second site is built around JSON (JavaScript Object Notation), an open standard file format which is language-independent.

Requests sent to FTP-based hosting sites generally return compressed files (e.g. .zip), also known as archive format. These files are stored in the Archives sub-directory in native format (e.g. .zip), then uncompressed to a .txt format and stored in the Uncompressed sub-directory. The uncompressed files (.txt) are then read, parsed and stored in .csv format in the Uncompressed sub-directory. JSON-based hosting sites return a content, which can be held in main memory (i.e. random-access memory) to be parsed and subsequently stored in .csv. The JSON framework bypasses the archiving (.zip) and decompressing (.txt) steps. In all cases (FTP, JSON), the extraction process is monitored and documented in .pdf files stored in the Audit sub-directory.

All file permissions are set to read-only to prevent unintended modifications. In addition, all file time stamps (birth, modification, access, change) are documented in .pdf files located in the Audit sub-directory (also in read-only permission mode).

All web service requests sent to the Federal Reserve of St. Louis site require an application program interface (API) key to identify requests. The general documentation on the API tool kits can be consulted at API Toolkits. The API key is set using the api_key variable, a 32 character lower-cased alpha-numeric string. The specific API key supporting this package is granted under the FRED® API Terms of Use and will not be shared with other users in compliance with the Terms of Use. In an effort to maintain the package integrity, further details on this topic will only be provided on a need-to-know basis.

ADDITIONAL NOTICE: Pursuant to the FRED® API Terms of Use, note that this product uses the FRED® API but is not endorsed or certified by the Federal Reserve Bank of St. Louis. See more details at Terms of Use

Value

A tibble object containing time stamps (e.g. date, year-month) and the requested time-series. The tibble has three attributes: string handle (i.e. catalog handle), series frequency and series units.


fognyc/factorr documentation built on Nov. 16, 2020, 8:48 p.m.