Learn R Programming

Ecfun (version 0.2-0)

financialCrisisFiles: Files containing financial crisis data

Description

FinancialCrisisFiles in Ecdat is an object of class financialCrisisFiles created by the financialCrisisFiles function to describe files containing data on financial crises downloadable from http://www.reinhartandrogoff.com/data/browse-by-topic/topics/7/.

Usage


financialCrisisFiles(files=c("22_data.xls", 
    "23_data.xls", "Varieties_Part_III.xls", 
    "25_data.xls"), ...)

Arguments

files

character vector of file names

arguments to pass with file and sheet name to read.xls when reading a sheet of an MS Excel file. This is assumed to be the same for all sheets of all files. If this is not the case, the resulting financialCrisisFiles object will have to be edited manually before using it to read the data.

Value

The function financialCrisisFiles returns a list of class financialCrisisFiles. This is a list with components carrying the names of files to be read. Each component is a list of optional arguments to pass to do.call(read.xls, ...) to read the sheet with name = name of that component.

The default value returned by financialCrisisFiles is the data object FinancialCrisisFiles. This corresponds to the files downloaded from http://www.reinhartandrogoff.com/data/browse-by-topic/topics/7/ in January 2013 (except for the fourth, which was not available there because of an error with the web site but instead was obtained directly from Prof. Reinhart).

Details

Reinhart and Rogoff (http://www.reinhartandrogoff.com) provide numerous data sets analyzed in their book, "This Time Is Different: Eight Centuries of Financial Folly". Of interest here are data on financial crises of various types for 70 countries spanning the years 1800 - 2010, downloadable from http://www.reinhartandrogoff.com/data/browse-by-topic/topics/7/.

The function financialCrisisFiles produces a list of class financialCrisisFiles describing four different Excel files in very similar formats with one sheet per Country and a few extra descriptor sheets. The data object FinancialCrisisFiles is the default output of that function.

It does this in several steps:

1. Read the first sheet of each file

2. Extract the names of the Countries from that first sheet.

3. Elimiate any blank spaces in the names to convert, e.g., "Costa Rica" to "CostaRica".

4. Find the sheets corresponding to each of the compressed names.

5. Construct the output list.

References

Carmen M. Reinhart and Kenneth S. Rogoff (2009) This Time Is Different: Eight Centuries of Financial Folly, Princeton U. Pr.

See Also

read.xls

Examples

Run this code
# NOT RUN {
Ecdat.demoFiles <- system.file('demoFiles', 
    package='Ecdat')
Ecdat.xls <- dir(Ecdat.demoFiles, 
    pattern='xls$', full.names=TRUE)
if(require(gdata) &&
        !fda::CRAN()){
  tst <- financialCrisisFiles(Ecdat.xls)
}
# }
# NOT RUN {
# check
\dontshow{stopifnot(}
all.equal(tst, data(FinancialCrisisFiles))
\dontrun{)}
# }

Run the code above in your browser using DataLab