worcs (version 0.1.2)

open_data: Use open data in WORCS project

Description

This function saves a data.frame as a .csv file (using write.csv), stores a checksum in '.worcs', and amends the .gitignore file to exclude filename.

Usage

open_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")
open_data(iris[1:5, ], codebook = "bla.Rmd")
setwd(old_wd)
unlink(test_dir, recursive = TRUE)
# }

Run the code above in your browser using DataCamp Workspace