make_dua_template {duawranglr} | R Documentation |
Interactive function to create template file
Description
Use this function to create a template script that puts package
functions in order and, based on question answers, prepopulates
some arguments. By default, this function is run in interactive
mode, meaning that it will not work in a script unless a list of
answers is given to answer_list
argument. Note that the
saved template file is not intended to be run as is, but only to
provide a starting structure for a cleaning script.
Usage
make_dua_template(file_name, include_notes = TRUE, answer_list = NULL)
Arguments
file_name |
Name with path of template script. |
include_notes |
If |
answer_list |
List of answer strings to provide if you don't
want to answer questions interactively. See details for
questions and expected input type. Leave as default |
Details
Questions to answer if using the answer_list
argument:
Do you want to set the DUA crosswalk file?
'Yes'
or'No'
DUA crosswalk file (with path): '< file name with path >'
Do the data need to be deidentified?
'Yes'
or'No'
Would like to select the ID column now?
'Yes'
or'No'
ID column name: '< column name string >'
If answers to questions (1) and (2) are No
, then strings for 1(a),
2(a), and 2(b) can be left empty since they will be ignored.
Examples
## Not run:
## run interactively
make_dua_template('data_clean.R')
## ...and don't include extra notes
make_dua_template('data_clean.R', include_notes = FALSE)
## End(Not run)
## make template to be filled in
file <- file.path(tempdir(), 'data_clean.R')
make_dua_template(file, answer_list = list('No','','No','',''))
## show
writeLines(readLines(file))