1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data.R
\name{use_data}
\alias{use_data}
\alias{use_data_raw}
\title{Create package data}
\usage{
use_data(
...,
internal = FALSE,
overwrite = FALSE,
compress = "bzip2",
version = 3,
ascii = FALSE
)
use_data_raw(name = "DATASET", open = rlang::is_interactive())
}
\arguments{
\item{...}{Unquoted names of existing objects to save.}
\item{internal}{If \code{FALSE}, saves each object in its own \code{.rda}
file in the \verb{data/} directory. These data files bypass the usual
export mechanism and are available whenever the package is loaded
(or via \code{\link[=data]{data()}} if \code{LazyData} is not true).
If \code{TRUE}, stores all objects in a single \code{R/sysdata.rda} file.
Objects in this file follow the usual export rules. Note that this means
they will be exported if you are using the common \code{exportPattern()}
rule which exports all objects except for those that start with \code{.}.}
\item{overwrite}{By default, \code{use_data()} will not overwrite existing
files. If you really want to do so, set this to \code{TRUE}.}
\item{compress}{Choose the type of compression used by \code{\link[=save]{save()}}.
Should be one of "gzip", "bzip2", or "xz".}
\item{version}{The serialization format version to use. The default, 3, can
only be read by R versions 3.5.0 and higher. For R 1.4.0 to 3.5.3, use
version 2.}
\item{ascii}{if \code{TRUE}, an ASCII representation of the data is
written. The default value of \code{ascii} is \code{FALSE} which
leads to a binary file being written. If \code{NA} and
\code{version >= 2}, a different ASCII representation is used which
writes double/complex numbers as binary fractions.}
\item{name}{Name of the dataset to be prepared for inclusion in the package.}
\item{open}{Open the newly created file for editing? Happens in RStudio, if
applicable, or via \code{\link[utils:file.edit]{utils::file.edit()}} otherwise.}
}
\description{
\code{use_data()} makes it easy to save package data in the correct format. I
recommend you save scripts that generate package data in \code{data-raw}: use
\code{use_data_raw()} to set it up. You also need to document exported datasets.
}
\examples{
\dontrun{
x <- 1:10
y <- 1:100
use_data(x, y) # For external use
use_data(x, y, internal = TRUE) # For internal use
}
\dontrun{
use_data_raw("daisy")
}
}
\seealso{
The \href{https://r-pkgs.org/data.html}{data chapter} of \href{https://r-pkgs.org}{R Packages}.
}
|