View source: R/dpgeneratedataresources.R
dpgeneratedataresources | R Documentation |
Generate Data Resources for a dataset
dpgeneratedataresources(
x,
name,
path = paste0(name, getextension(format)),
format = "csv",
mediatype = getmediatype(format),
format_codelists = format,
mediatype_codelists = getmediatype(format_codelists),
...
)
x |
|
name |
name of the Data Resource |
path |
name of the file in which to store the dataset. This should be a path relative to the location of the directory in which the Data Package in which the Data Resource will be stored. |
format |
the data format in which the data is stored. |
mediatype |
mediatype of the data |
format_codelists |
data format to use for the code lists |
mediatype_codelists |
mediatyp of the code lists |
... |
Currently ignored |
Returns a list
with Data Resource objects. The first Data Resource is
that of the dataset x
itself. Additional Data Resources are for the
code lists of the variables. Code lists are generated for fields that have a
code list and for factor
variables.
Note that this function does not create the file at path
. The export
of the Data Resource is automatically set to CSV.
# generate an example dataset
dta <- data.frame(a = 1:3, b = factor(letters[1:3]))
resources <- dpgeneratedataresources(dta, "example")
print(resources)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.