R: Making data available as data.frame

provide.data {sm} | R Documentation

## Making data available as data.frame

### Description

This function is no longer available in the sm package. It should be replaced by the use of `attach`, if necessary. Each dataset now also has its own help file.

It was a utility function, widely used in the scripts accompanying the book described below. The function provided access to the dataset identified by `name`. For flexibility, the datasets were provided in ASCII form, with the name of each variable listed in the first row of the file. This function reads the files and makes the data available as a data frame.

### Usage

    provide.data(data, path, options = list())

### Arguments

`data` | name of the data to be loaded and attached as `data.frame`
`path` | the path where the data and its documentation should be searched for, The default value is an appropriate sub-directory of the `sm` package.
`options` | A list of options passed to `sm.options`. The one used is `describe`, a logical flag. If `describe=TRUE` (default), a documentation file of the data is searched and printed, if available.

### Details

the data file is assumed to be called `data`.dat and the documentation file describing the data (if present) is assumed to be called `data`.doc. If the `data.frame` is already attached, it is re-attached in the second position of the `search` list.

To set `describe=FALSE` for the rest of the current session, use `sm.options(describe=FALSE)`

The function can easily be adapted to play a similar role for other packages.

### Value

none

### Side Effects

messages are printed on the command window, describing progress of the operation. If `describe=TRUE` and a documentation file exists, this is printed on the command windows or another windows, depending on the type of platform where the program is executed.

### Author(s)

Bowman, A.W. and Azzalini, A.

### See Also

`data.frame`, `attach`, `sm`, `sm.options`

### Examples

    provide.data(birth)

[Package sm version 2.2-5.4 Index]