data
Data Sets

Description

Loads data sets from the specified packages into the global or other specified environment. The function can also get a list of the available data sets in the specified packages.

Usage

data(..., list = character(0), package = NULL, lib.loc = NULL, 
    verbose = getOption("verbose"), envir = .GlobalEnv)
## S3 method for class 'packageIQR':
print(x, ...) 

Arguments

... one or more names of data objects to be loaded from package to envir.

For print.packageIQR, ... is not used and is kept to be compatible with generic function print.

list a character vector of data object names. This is an alternative way to specified the data sets to be loaded.
package a character vector giving the names of the package(s) to search. The default value is NULL, which means that all attached packages are searched. (Note that most of the example data are in the packages "datasets" and "Sdatasets".)
lib.loc a character string or vector giving the path(s) to search for the packages.
verbose a logical flag. If TRUE, verbose warning messages are displayed.
envir the environment into which objects are loaded.

Details

If the argument ... or list is given, then the function tests to see if the object exists and gives a warning if it does not exist. The function tries to find the corresponding data sets from the file Rdata.rds or from the file Rdata.zip. Copies of the found data sets are made in envir.
If ... or list is not given, then data lists all available data sets in the specified package(s).
If data is called with no arguments, then a list of data sets in all attached packages is returned. In this case, an object of class "packageIQR" is returned, which contains the dataset information in specified package(s). This information is read from the file <package path>/Meta/data.rds, if that file exists.
print.packageIQR is a method of the generic function print for class "packageIQR", which is hidden in the utils package namespace. A popup window containing datasets information (grouped by package) is displayed when this method is called.
Value
an invisible character vector of the data sets specified, or an object of class "packageIQR" containing lists of all data sets in a package if only package is given.
An object of class "packageIQR" contains following components:
title The title of character string "Data sets".
header The header information. Currently, it is NULL.
results A (m x 4) character matrix with column name "Package", "LibPath", "Item" and "Title", where m is the number of all datasets in the specified package(s).
footer The footer information. Currently, it is NULL if package is specified or the help message "Use 'data(package = .packages(all.available = TRUE))' to list the data sets in all *available* packages." if package is missing.
See Also
get, .find.package, .path.package, lazyLoad, options,
Examples
# Copy the co2 data set to the global environment:
data(co2)

# List all data sets in the Sdatasets package: data(package="Sdatasets")

Package utils version 6.1.1-7
Package Index