new_data: Add and Document ('roxygen2' Style) Data

Description Usage Arguments Value References See Also Examples

Description

Add a ‘.rda’ file to the ‘data’ directory of a package and document roxygen2 style in the
R/____package.R’ file.

Usage

1
2
new_data(data, data.path = "data", stand.alone = FALSE,
  doc.path = sprintf("R/%s-package.R", basename(getwd())))

Arguments

data

A data set (environment, list, data.frame, vector).

data.path

The path to the data directory (where the data will be placed). Defaults to ‘data’.

stand.alone

logical. If TRUE the documentation is added to its own file.

doc.path

The path to the package documentation ‘.R’ file. Use NULL to skip adding documentation.

Value

Generates a ‘____.rda’ file and accompanying roxygen2 style documentation.

References

http://r-pkgs.had.co.nz/data.html#documenting-data

See Also

Other new functions: new_r_test, new_r, new_test, new_vignette

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
pax("temp_dir", open = FALSE)
dir.create("temp_dir/data")
## Note: If used in RStudio with the root directory set to the 
##       package the user does not need to supply `data.path` or `doc.path`
new_data(mtcars, data.path = "temp_dir/data", 
    doc.path = "temp_dir/R/temp_dir-package.R")
unlink("temp_dir", TRUE, TRUE)

## End(Not run)

trinker/pax documentation built on May 31, 2019, 9:42 p.m.