threeway_download: The threeway_download function

View source: R/ffdata_download.R

threeway_downloadR Documentation

The threeway_download function

Description

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

Usage

threeway_download(
  base,
  dir,
  sub_path,
  subtype,
  dividends,
  start,
  end,
  clean_na
)

Arguments

base

a character string, the Kenneth R. French Data Library address.

dir

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

sub_path

a character string, the folder subpath, created by ffDataDownload.

subtype

a character string, the Threeway portfolio subtype. Possible values are "ME_BEME_OP" (default), "ME_BEME_INV" or "ME_OP_INV".

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.

clean_na

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.


antshi/ffData documentation built on June 13, 2025, 4:54 p.m.