Use data in a package.

Share:

Description

This function makes it easy to save package data in the correct format.

Usage

1
2
use_data(..., pkg = ".", internal = FALSE, overwrite = FALSE,
  compress = "bzip2")

Arguments

...

Unquoted names of existing objects to save.

pkg

Package where to store data. Defaults to package in working directory.

internal

If FALSE, saves each object in individual .rda files in the data/ directory. These are available whenever the package is loaded. If TRUE, stores all objects in a single R/sysdata.rda file. These objects are only available within the package.

overwrite

By default, use_data will not overwrite existing files. If you really want to do so, set this to TRUE.

compress

Choose the type of compression used by save. Should be one of "gzip", "bzip2" or "xz".

See Also

Other infrastructure: infrastructure, use_build_ignore, use_data_raw, use_news_md, use_package, use_readme_rmd

Examples

1
2
3
4
5
6
7
8
## Not run: 
x <- 1:10
y <- 1:100

use_data(x, y) # For external use
use_data(x, y, internal = TRUE) # For internal use

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.