Learn R Programming

Hmisc (version 5.1-3)

getHdata: Download and Install Datasets for Hmisc, rms, and Statistical Modeling

Description

This function downloads and makes ready to use datasets from the main web site for the Hmisc and rms libraries. For R, the datasets were stored in compressed save format and getHdata makes them available by running load after download. For S-Plus, the datasets were stored in data.dump format and are made available by running data.restore after import. The dataset is run through the cleanup.import function. Calling getHdata with no file argument provides a character vector of names of available datasets that are currently on the web site. For R, R's default browser can optionally be launched to view html files that were already prepared using the Hmisc command html(contents()) or to view .txt or .html data description files when available.

If options(localHfiles=TRUE) the scripts are read from local directory ~/web/data/repo instead of from the web server.

Usage

getHdata(file, what = c("data", "contents", "description", "all"),
         where="https://hbiostat.org/data/repo")

Value

getHdata() without a file argument returns a character vector of dataset base names. When a dataset is downloaded, the data frame is placed in search position one and is not returned as value of

getHdata.

Arguments

file

an unquoted name of a dataset on the web site, e.g. prostate. Omit file to obtain a list of available datasets.

what

specify what="contents" to browse the contents (metadata) for the dataset rather than fetching the data themselves. Specify what="description" to browse a data description file if available. Specify what="all" to retrieve the data and see the metadata and description.

where

URL containing the data and metadata files

Author

Frank Harrell

See Also

download.file, cleanup.import, data.restore, load

Examples

Run this code
if (FALSE) {
getHdata()          # download list of available datasets
getHdata(prostate)  # downloads, load( ) or data.restore( )
                    # runs cleanup.import for S-Plus 6
getHdata(valung, "contents")   # open browser (options(browser="whatever"))
                    # after downloading valung.html
                    # (result of html(contents()))
getHdata(support, "all")  # download and open one browser window
datadensity(support)
attach(support)     # make individual variables available
getHdata(plasma,  "all")  # download and open two browser windows
                          # (description file is available for plasma)
}

Run the code above in your browser using DataLab