create_script: Create a script

Description Usage Arguments Details Value Methods (by class) Author(s) See Also Examples

Description

Create a script according to the definition of the variables and a template .

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
create_script(var_desc, template, rawdata_name = "raw_data",
  cleandata_name = "clean_data", header = TRUE, footer = TRUE, ...)

## S4 method for signature 'VariableDef,ScriptTemplate'
create_script(var_desc, template,
  rawdata_name = "raw_data", cleandata_name = "clean_data",
  header = FALSE, footer = FALSE, columns_names = var_desc$rname)

## S4 method for signature 'VariableDef,character'
create_script(var_desc, template,
  rawdata_name = "raw_data", cleandata_name = "clean_data", header = TRUE,
  footer = TRUE, ...)

## S4 method for signature 'VariableDef,ANY'
create_script(var_desc, template,
  rawdata_name = "raw_data", cleandata_name = "clean_data", header = TRUE,
  footer = TRUE, ...)

## S4 method for signature 'DatabaseDef,ANY'
create_script(var_desc, template,
  rawdata_name = "raw_data", cleandata_name = "clean_data", header = TRUE,
  footer = TRUE, ...)

## S4 method for signature 'data.frame,ANY'
create_script(var_desc, template,
  rawdata_name = "raw_data", cleandata_name = "clean_data", header = TRUE,
  footer = TRUE, ...)

Arguments

var_desc

An object which describes the variable. Could be a single VariableDef, a whole DatabaseDef or a simple data.frame. In this last case, import_vardef function will be called to transform it to a DatabaseDef.

template

Optional. An object which describes the template. Either a ScriptTemplate object or a path to the template file. In this last case, import_template function will be called to transform this filepath to a ScriptTemplate. If missing, the default template is used.

rawdata_name

Name used to replace rep_rawdata in the template

cleandata_name

Name used to replace rep_cleandata in the template

header

If TRUE produce the header bloc

footer

If TRUE produce the footer bloc

...

others arguments for specifics methods

columns_names

rnames of the columns

Details

create_script is the central function of the vartors package. It will collate the two input objects created by the user (a VariableDef object or DatabaseDef object and a ScriptTemplate object) and will produce the final product : the script skeleton represented by an ScriptOutput object.

Value

A ScriptOutput object. This object could be written in a file with the write_file function.

Methods (by class)

Author(s)

Joris Muller

See Also

import_template, import_vardef and the general documentation of vartors.

Examples

1
2
3
4
5
6
7
8
# Import a data.frame containing the description of the variables
# Show the description of the variable
sample_descvar

# Create the script skeleton simply with create_script()
script_skeleton <- create_script(sample_descvar)
# watch the result
script_skeleton

jomuller/vartors documentation built on May 19, 2019, 7:26 p.m.