download_data: Download data and read into R

View source: R/read_data.r

download_dataR Documentation

Download data and read into R

Description

These functions are downloading, reading, and attaching data sets described in the hdrm book. To keep the size of the hdrm package manageable, these data sets are not included with the package and must be downloaded separately using download_data(); this only needs to be done once.

Usage

download_data(name)

read_data(name)

attach_data(name, envir = parent.frame())

Arguments

name

Name of data set to read/attach

envir

If attaching, to which environment?

Details

Data sets in hdrm are lists consisting of X, y, and possibly other elements. read_data returns the list as an object that the user can name and use how they want. attach_data assigns the elements of the list into the user's environment. attach_data is often more convenient, but offers less control and potentially introduces side effects, such as overwriting an existing object X if one already exists. See the examples for more details.

Examples

## Not run: 
download_data()         # Download all data sets
download_data(brca1)    # Download a specific data set
## End(Not run)
Data <- read_data(brca1)
dim(Data$X)
head(Data$y)
attach_data(brca1)
dim(X)
head(y)

pbreheny/hdrm documentation built on March 29, 2025, 5:18 a.m.