Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

French

Download Datasets from Kenneth French's Data Library


Description

Download datasets from Kenneth French's Data Library.

Usage

French(dest.dir,
       dataset = "F-F_Research_Data_Factors_CSV.zip",
       weighting = "value", frequency = "monthly",
       price.series = FALSE, na.rm = FALSE,
       adjust.frequency = TRUE)

Arguments

dest.dir

character: a path to a directory

dataset

a character string: the CSV file name. Also supported are the keywords ‘market’ and ‘rf’.

weighting

a character string: "equal" or "value"

frequency

a character string: daily, monthly or annual. Whether it is used or ignored depends on the particular dataset.

price.series

logical: convert the returns series into prices series?

na.rm

logical: remove missing values in the calculation of price series?

adjust.frequency

logical: if TRUE, frequency is switched to ‘"daily"’ when the word ‘"daily"’ appears in the dataset's name

Details

The function downloads data provided by Kenneth French at http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html. The download file gets a date prefix (current date in format YYYYMMDD) and is stored in directory dest.dir. Before any download is attempted, the function checks whether a file with today's prefix exist in dest.dir; if yes, the file is used.

In the original data files, missing values are coded as -99 or similar. These numeric values are replaced by NA.

Calling the function without any arguments will print the names of the supported datasets (and return them insivibly).

Value

a data.frame, with contents depending on the particular dataset

Author(s)

Enrico Schumann

References

Gilli, M., Maringer, D. and Schumann, E. (2019) Numerical Methods and Optimization in Finance. 2nd edition. Elsevier. https://www.elsevier.com/books/numerical-methods-and-optimization-in-finance/gilli/978-0-12-815065-8

Schumann, E. (2019) Financial Optimisation with R (NMOF Manual). http://enricoschumann.net/NMOF.htm#NMOFmanual

See Also

Examples

## list all supported files
French()

## Not run: 
archive.dir <- "~/Downloads/French"
if (!dir.exists(archive.dir))
    dir.create(archive.dir)
French(archive.dir, "F-F_Research_Data_Factors_CSV.zip")

## End(Not run)

NMOF

Numerical Methods and Optimization in Finance

v2.4-1
GPL-3
Authors
Enrico Schumann [aut, cre] (<https://orcid.org/0000-0001-7601-6576>)
Initial release
2021-04-09

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.