Opens the documentation for a dataset from Rdatasets as an HTML page using getOption("viewer")
or the Rstudio viewer.
Arguments
- dataset
String. Name of the dataset to download from the Rdatasets archive. Use
rdsearch()
to search available datasets.- package
String. Package name that originally published the data. If NULL, the function will attempt to automatically detect the package by searching for an exact match in the Rdatasets index.
Value
Invisibly returns NULL
. The function's primary purpose is to open the dataset documentation in a viewer window.
Details
The function attempts to open the documentation in the following order:
RStudio's built-in viewer (if
rstudioapi
is available)The viewer specified in
getOption("viewer")
The default browser specified in
getOption("browser")
To control which viewer is used, you can set the following options:
options(viewer = function(url) { ... })
- Set a custom viewer functionoptions(browser = "firefox")
- Set the default browser (used as fallback)
If no viewer is available, the function will stop with an error message.
Global Options
The following global options control package behavior:
Rdatasets_cache
: LogicalWhether to cache downloaded data and index for faster subsequent access. Default:
TRUE
. Please keep this option TRUE as it makes repeated access faster and avoids overloading the Rdatasets server. Only set to FALSE if local memory is severely limited.Ex: `options(Rdatasets_cache = TRUE)“
Rdatasets_class
: StringOutput class of the returned data. One of "data.frame" (default), "tibble", or "data.table". Default:
"data.frame"
. Requires the respective packages to be installed for "tibble" or "data.table" formats.Ex:
options(Rdatasets_class = "tibble")
Rdataset_path
: String.Base URL for the Rdatasets archive. Default:
"https://vincentarelbundock.github.io/Rdatasets/"
. Advanced users can set this to use a different mirror or local copy.Ex:
options(Rdataset_path = "https://vincentarelbundock.github.io/Rdatasets/")