Package 'frenchdata'

Title: 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.
Authors: Nelson Areal [aut, cre]
Maintainer: Nelson Areal <[email protected]>
License: MIT + file LICENSE
Version: 0.2.0.9200
Built: 2024-11-17 04:25:29 UTC
Source: https://github.com/nareal/frenchdata

Help Index


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:

  • info - holds the information about when and were the information was retrieved.

  • details_url - url for the webpage with details on data set.

  • subsets a tibble with with the subsets contained in the downloaded file, the tibble contains a name and data column.

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:

  • A class attribute of french_data_list.

  • A base type of "list" with the following elements:

    • info - holds the information about when and were the information was retrieved.

    • files_list a tibble with with a list of files that can be downloaded, the tibble contains a name, file_url and details_url column.

Behavior of french_data_list

  • Pretty prints the object.


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:

  • A class attribute of french_dataset.

  • A base type of "list" with the following elements:

    • info - holds the information about when and were the information was retrieved.

    • details_url - url for the webpage with details on data set.

    • subsets a tibble with with the subsets contained in the downloaded file, the tibble contains a name and data column.

Behavior of french_dataset

  • Pretty prints the object.


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:

  • info - holds the information about when and were the information was retrieved.

  • files_list a tibble with with a list of files that can be downloaded, the tibble contains a name, file_url and details_url column.

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