export_all: Export Data, Codebook, and Scripts

Description Usage Arguments Details Value See Also Examples

Description

Export any dataframe that has been processed in R with additional options to also produce a codebook and relevant scripts

Usage

1
2
3
4
export_all(data, filename, location = c("processed", "open"),
  directory = "auto", format = "csv", na = "", codebook = FALSE,
  codebook_dir = "auto", scripts = NULL, script_file,
  script_dir = "auto")

Arguments

data

Data frame to export

filename

the name of the exported file, without the extension

location

If using the puddingR file directory, automatically place the file inside either the open_data folder ("open") the processed_data ("processed"), or outside of the R directory, and in the larger Pudding starter template ("js"), Default: 'open'

directory

Directory of the exported file. If set to "auto", this assumes that the project follows the puddingR structure. Otherwise, the "location" parameter is overwritten by the directory in this argument, Default: 'auto'

format

file output format (either "csv", "json", or "tsv"), Default: 'csv'

na

How to export NA values, Default: ”

codebook

Whether to export a codebook using the render_codebook() function, Default: FALSE

codebook_dir

Where to export the codebook, default assumes using the puddingR file structure, Default: "auto" which outputs to the "open_data/intermediate" folder.

scripts

Character vector of code chunk names to export to a .R script, Default: NULL

script_file

The .Rmd file to find the code chunks in (requires directory to find file)

script_dir

Directory of where to put the resulting .R script. Defaults to the "open_data" directory in puddingR template, Default: 'auto'

Details

DETAILS

Value

OUTPUT_DESCRIPTION

See Also

map case_when here

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
# assuming use of puddingR file template
export_all(mtcars, "cars", codebook = TRUE, scripts = c("load_packages", "analyze_data"),
script_file = "analysis.Rmd")

 # assuming not using puddingR template
 export_all(mtcars, "cars", directory = "data/my_data/",
 codebook = TRUE, codebook_dir = "data/codebooks/")

## End(Not run)

the-pudding/puddingR documentation built on June 25, 2019, 12:15 a.m.