worcs (version 0.1.2)

closed_data: Use closed data in WORCS project

Description

This function saves a data.frame as a .csv file (using write.csv), stores a checksum in '.worcs', appends the .gitignore file to exclude filename, and saves a synthetic copy of data for public use. To generate these synthetic data, the function synthetic is used.

Usage

closed_data(
  data,
  filename = "data.csv",
  codebook = "codebook.Rmd",
  worcs_directory = ".",
  ...
)

Arguments

data

A data.frame to save.

filename

Character, naming the file data should be written to.

codebook

Character, naming the file the codebook should be written to. An 'R Markdown' codebook will be created and rendered to github_document ('markdown' for 'GitHub'). Defaults to 'codebook.Rmd'. Set to NULL to avoid creating a codebook.

worcs_directory

Character, indicating the WORCS project directory to which to save data. The default value "." points to the current directory.

...

Additional arguments passed to and from functions.

Value

Returns NULL invisibly. This function is called for its side effects.

See Also

open_data closed_data save_data

Examples

Run this code
# NOT RUN {
test_dir <- file.path(tempdir(), "data")
old_wd <- getwd()
dir.create(test_dir)
setwd(test_dir)
worcs:::write_worcsfile(".worcs")
closed_data(iris[1:10, ], codebook = NULL)
setwd(old_wd)
unlink(test_dir, recursive = TRUE)
# }

Run the code above in your browser using DataLab