Skip to contents

Insert a comment header into am R script

Usage

insert_comment_header(
  author,
  email = NULL,
  header = NULL,
  description = NULL,
  script_title = basename(rstudioapi::documentPath(id = target)),
  type = c("small", "large"),
  target = rstudioapi::documentId(allowConsole = FALSE)
)

Arguments

author

Name of the creator of the script.

email

Email of the creator of the script.

header

A brief title of the script

description

Description of the script.

script_title

The file name of the script. By default, the file name of the script file is used if it has already been saved or is skipped silently otherwise.

type

Appearance of the header. Either "small" (the default) to create a smaller format with a lesser footprint, or "large" to create a larger header comprising more details.

target

The RStudio id of the target R script. It must be opened in RStudio's editor pane. By default the currently focused file is used. The id can be obtained using rstudioapi::documentId().