datapackage_init {dpmr} | R Documentation |
Initialise a data package from a data frame, metadata list, and source code file used to create the data set.
Description
Initialise a data package from a data frame, metadata list, and source code file used to create the data set.
Usage
datapackage_init(df, package_name = NULL, output_dir = getwd(),
meta = NULL, source_cleaner = NULL, source_cleaner_rename = TRUE, ...)
Arguments
df |
The object name of the data frame you would like to convert into a data package. |
package_name |
character string name for the data package. Unnecessary
if the |
output_dir |
character string naming the output directory to save the data package into. By default the current working directory is used. |
meta |
The list object with the data frame's meta data. The list
item names must conform to the Open Knowledge Foundation's Data Package
Protocol (see http://dataprotocols.org/data-packages/). Must include
the |
source_cleaner |
a character string or vector of file paths relative to
the current working directory pointing to the source code file used to gather
and clean the |
source_cleaner_rename |
logical. Whether or not to rename the
|
... |
arguments to pass to |
Examples
## Not run:
# Create fake data
A <- B <- C <- sample(1:20, size = 20, replace = TRUE)
ID <- sort(rep('a', 20))
Data <- data.frame(ID, A, B, C)
# Initialise data package with barebones, automatically generated metadata
datapackage_init(df = Data, package_name = 'my-data-package')
# Initialise with user specified metadata
meta_list <- list(name = 'my-data-package',
title = 'A fake data package',
last_updated = Sys.Date(),
version = '0.1',
license = data.frame(type = 'PDDL-1.0',
url = 'http://opendatacommons.org/licenses/pddl/'),
sources = data.frame(name = 'Fake',
web = 'No URL, its fake.'))
datapackage_init(df = Data, meta = meta_list)
## End(Not run)