Description Usage Arguments Details Value Author(s) Source References See Also Examples
View source: R/financialCrisisFiles.R
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/.
1 2 3 | financialCrisisFiles(files=c("22_data.xls",
"23_data.xls", "Varieties_Part_III.xls",
"25_data.xls"), ...)
|
files |
character vector of file names |
... |
arguments to pass with file and sheet name to
|
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.
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).
Spencer Graves
http://www.reinhartandrogoff.com
Carmen M. Reinhart and Kenneth S. Rogoff (2009) This Time Is Different: Eight Centuries of Financial Folly, Princeton U. Pr.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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{)}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.