create_r_script_title_box: Create an R script file with preamble in either the basic or...

Description Usage Arguments Value Examples

View source: R/create_r_script_title_box.R

Description

Create an R script file with preamble in either the basic or roxygen2 format.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
create_r_script_title_box(
  title,
  author,
  email,
  date_created = Sys.Date(),
  date_last_modified = Sys.Date(),
  description,
  params = NULL,
  output = NULL,
  license = "MIT",
  linewidth = 80,
  right_margin = 4,
  left_margin = 1,
  type = c("basic", "roxygen2"),
  write_to_file = NULL
)

Arguments

title

Character string with title of script.

author

Author's name

email

Author's email address

date_created

Date the script file was created. Defaults to today.

date_last_modified

Date the script file was last modified. Defaults to today.

description

Character string description of the script's function.

params

A vector of strings detailing the parameters (most useful if script is a function.)

output

A string detailing the output of the script.

license

A string detailing the license for the code.

linewidth

Maximum number of characters per line.

right_margin

Number of spaces between the end of text and the maximum linewidth.

left_margin

Number of spaces before the beginning of text.

type

Two options:

  • basic: Simple format with # box at the beginning.

  • roxygen2: Format consistent with package builder roxygen2.

write_to_file

File to create with preamble. If NULL, then outputted to the console.

Value

If file runs cleanly, then output is TRUE.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
description <- "\nThe following code:
 - solves existential dread,
 - the problem of evil
 - the need for accountants."
create_r_script_title_box(
  title = "A script about nothing",
  author = "D. W. Kennedy",
  email = "not.my.email@gmail.com",
  license = "",
  description = description,
  type = "basic",
  params = c("blah a parameter which is not important.",
   "verbose Should progress messages be shown?")
)

danwkenn/ConsulR documentation built on Dec. 19, 2021, 8:11 p.m.