Skip to contents

Takes a given template file/yaml mapping file combination, reads in that information, checks to make sure the mapping information is correct and then returns an onbrand object.

Usage

read_template(
  template = file.path(system.file(package = "onbrand"), "templates", "report.pptx"),
  mapping = file.path(system.file(package = "onbrand"), "templates", "report.yaml"),
  verbose = TRUE
)

Arguments

template

Name of PowerPoint or Word file to annotate (defaults to included PowerPoint template)

mapping

Name of yaml file with configuration information

verbose

Boolean variable when set to TRUE (default) messages will be displayed on the terminal; Messages will be included in the returned onbrand object.

Value

onbrand object which is a list with the following elements:

  • isgood: Boolean variable indicating the current state of the object

  • rpt: Officer object containing the initialized report

  • rpttype: Type of report (either PowerPoint or Word)

  • key_table: Empty (NULL) mapping table for tracking cross referencing (Word only)

  • placeholders: Empty list to hold placeholder substitution text (Word only)

  • meta: Metadata read in from the yaml file

  • mapping: Mapping yaml file

  • msgs: Vector of messages indicating any errors that were encountered

Examples

obnd = read_template(
      template = file.path(system.file(package="onbrand"), "templates", "report.pptx"),
      mapping  = file.path(system.file(package="onbrand"), "templates", "report.yaml"))

obnd = read_template(
      template = file.path(system.file(package="onbrand"), "templates", "report.docx"),
      mapping  = file.path(system.file(package="onbrand"), "templates", "report.yaml"))