Learn R Programming

DataPackageR (version 0.16.2)

use_processing_script: Add a processing script to a data package.

Description

The Rmd or R file or directory specified by file will be moved into the data-raw directory. It will also be added to the yml configuration file. Any existing file by that name will be overwritten when overwrite is set to TRUE

Usage

use_processing_script(
  file = NULL,
  title = NULL,
  author = NULL,
  overwrite = FALSE
)

Value

invisibly returns TRUE for success. Stops on failure.

Arguments

file

character path to an existing file or name of a new R or Rmd file to create.

title

character title of the processing script for the yaml header. Used only if file is being created.

author

character author name for the yaml header. Used only if the file is being created.

overwrite

logical default FALSE. Overwrite existing file of the same name.

Examples

Run this code
if(rmarkdown::pandoc_available()){
myfile <- tempfile()
file <- system.file("extdata", "tests", "extra.Rmd",
                     package = "DataPackageR")
datapackage_skeleton(
  name = "datatest",
  path = tempdir(),
  code_files = file,
  force = TRUE,
  r_object_names = "data")
use_processing_script(file = "newScript.Rmd",
    title = "Processing a new dataset",
    author = "Y.N. Here.")
}

Run the code above in your browser using DataLab