Title: Download Data Sets from Kenneth's French Finance Data Library Site
Version: 0.2.0
Description: Download data sets from Kenneth's French finance data library site http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html, reads all the data subsets from the file. Allows R users to collect the data as 'tidyverse'-ready data frames.
License: MIT + file LICENSE
URL: https://nareal.github.io/frenchdata/, https://github.com/nareal/frenchdata
BugReports: https://github.com/nareal/frenchdata/issues
Depends: R (≥ 3.3)
Encoding: UTF-8
RoxygenNote: 7.1.1
Imports: utils, magrittr, tibble, dplyr, tidyr (≥ 1.0.0), cli, httr, rvest (≥ 1.0.0), stringr, purrr, assertthat, rlang, fs, readr
Suggests: markdown, rmarkdown, knitr, lubridate, ggplot2
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2021-09-08 20:48:25 UTC; nareal
Author: Nelson Areal ORCID iD [aut, cre]
Maintainer: Nelson Areal <nareal@gmail.com>
Repository: CRAN
Date/Publication: 2021-09-10 12:10:11 UTC

frenchdata: Download Data Sets from Kenneth's French Finance Data Library Site

Description

Download data sets from Kenneth's French finance data library site <http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html>, reads all the data subsets from the file. Allows R users to collect the data as 'tidyverse'-ready data frames.

Author(s)

Maintainer: Nelson Areal nareal@gmail.com (ORCID)

See Also

Useful links:


Browse the details webpage of a Kenneth's French data set

Description

Opens the details webpage of a data set on the default browser.

Usage

browse_details_page(fds)

Arguments

fds

an object of class french_dataset

Value

Does not return a value. Opens the details webpage of a data set on the default browser window.

Examples


if(interactive()){
  ff_3f <- download_french_data('Fama/French 3 Factors')
  browse_details_page(ff_3f)
}



Browse Kenneth's French data library website

Description

Opens the data library website on the default browser https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html

Usage

browse_french_site()

Value

Does not return a value. Opens the Kenneth's French data library website with the default browser.

Examples


if(interactive()){
  browse_french_site()
}



Download the data set

Description

Download the data set

Usage

download_french_data(
  dataset_name,
  dir = NULL,
  dest_file = NULL,
  overwrite = FALSE,
  max_tries = 3
)

Arguments

dataset_name

string with the data set name. Use get_french_data_list() to get the list of data sets available to download.

dir

character. Should be a valid directory path where to save the compressed downloaded file.

dest_file

character. Should be a valid file name to save the compressed downloaded file. If dir is defined and dest_file is left empty, the original file name will be used.

overwrite

boolean. Overwrite an existing file?

max_tries

numeric. Number of file download trials.

Value

An objects of class french_dataset with the following elements:

Examples


ff_3f <- download_french_data('Fama/French 3 Factors')
ff_3f


french_data_list S3 class

Description

The french_data_list exists to hold the results of reading the files lists of Kenneth's French data library.

It provides a method to print the objects of this class.

Properties of french_data_list

Objects of class french_data_list have:

Behavior of french_data_list


french_dataset S3 class

Description

The french_dataset exists to hold the results of reading the files lists of Kenneth's French data library.

It provides a method to print the objects of this class.

Properties of french_dataset

Objects of class french_dataset have:

Behavior of french_dataset


Get list of files available on Kenneth's French data library website

Description

Extract the list of files along with a description and links to them and additional information from the data library page of Prof. Kenneth French website.

Usage

get_french_data_list(max_tries = 3, refresh = FALSE)

Arguments

max_tries

a number defining the maximum number of tries to perform when downloading the page.

refresh

logical. If TRUE re-downloads the page and overwrites the cached information. Otherwise use the cached data if a download has been done in the current session.

Value

An object of class french_data_list with the following elements:

Examples


files_list <- get_french_data_list()
files_list



Generic print method for objects of class french_data_list

Description

Prints an object of class french_data_list

Usage

## S3 method for class 'french_data_list'
print(x, ...)

Arguments

x

an object of class french_data_list

...

other arguments passed to print()

Value

Return a tbl_df/data.frame class object from the files_list element of x.

Examples


files_list <- get_french_data_list()
print(files_list)
files_list


Generic print method for objects of class french_dataset

Description

Prints an object of class french_dataset

Usage

## S3 method for class 'french_dataset'
print(x, ...)

Arguments

x

an object of class french_dataset

...

other arguments passed to print()

Value

Return a tbl_df/data.frame class object from the subsets element of x.

Examples


ff_3f <- download_french_data('Fama/French 3 Factors')
print(ff_3f)
ff_3f