ffDataDownload: The ffDataDownload function

Description Usage Arguments Value Examples

View source: R/ffDataDownload.R

Description

This function automatically downloads user-specified portfolio returns from the Kenneth R. French Data Library. The downloaded returns are saved as a .csv-file in the chosen directory.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
ffDataDownload(
  dir = NULL,
  type = "USResearch",
  subtype = NULL,
  number_factors = NULL,
  freq = "m",
  dividends = TRUE,
  start = NULL,
  end = NULL,
  cleanNAs = TRUE
)

Arguments

dir

a character string, the directory for saving the data. The current working directory is set by default.

type

a character string, the portfolio type. Possible values are "USResearch" (default) for the Fama-French 3 or 5 Factors, "Industry" for the Industry portfolios, "Bivariate" for the Bivariate sorts on Size (ME), Book-to-Market (BE), Operational Profitability (OP) and Investment (INV), "Threeway" for the Three-way sorts on Size (ME), Book-to-Market (BE), Operational Profitability (OP) and Investment (INV).

subtype

a character string, the portfolio subtype. Possible values are "ME_BE", "ME_OP", "ME_INV", "BEME_OP", "BEME_INV", "OP_INV" (for the Bivariate type) and "ME_BEME_OP", "ME_BEME_INV", "ME_OP_INV" (for the Threeway type).

number_factors

an integer, the number of factors for the portfolios. Possible values are 3 (default) or 5 (for the USResearch portfolios); 5 (default), 10, 12, 17, 30, 38, 48 or 49 (for the Industry portfolios) and 6 (default), 25 or 100 (for the Bivariate portfolios).

freq

a character string, the frequency of returns. Possible values are "m" for monthly (default) or "d" for daily.

dividends

a logical, TRUE (default) considers dividends. FALSE downloads the data without dividends.

start

a character string, start date for the download in the format "YYmm". Default value is 197501.

end

a character string, end date for the download in the format "YYmm". Default value is two months before Sys.Date() to insure availability.

cleanNAs

a logical, TRUE (default) replaces NAs with zoo::na.locf(). If FALSE, NAs are not cleaned.

Value

a .csv-file within the directory, defined in dir.

Examples

1
2
3
library(ffData)
ffDataDownload()
ffDataDownload(freq="m", type="Bivariate", subtype="ME_BE", number_factors=25)

antshi/ffData documentation built on Oct. 24, 2020, 9:56 p.m.