Learn R Programming

docket (version 1.33)

getBatchDictionary: Dictionary for multiple docket outputs

Description

Scans the input file for strings enclosed by flag wings: « ». Creates a replacement value column for each document to be generated

Usage

getBatchDictionary(
  filename,
  outputFiles,
  dictionaryLength = length(outputFiles)
)

Value

Data frame for populating data into the template with row 1 containing the output file names

Arguments

filename

The file path to the document template

outputFiles

A list of the file names and paths for the populated templates

dictionaryLength

Number of columns in the batch dictionary. Defaults to the number of output files. Cannot be shorter than the count of 'outputFiles'

Examples

Run this code
# Path to the sample template file included in the package
template_path <- system.file("batch_document", "batchTemplate.docx", package="docket")
temp_dir <- normalizePath(tempdir(), winslash = "/")
output_paths <- as.list(paste0(temp_dir, paste0("/batch document", 1:5, ".docx")))

# Create a dictionary by using the getDictionary function on the sample template file
result <- getBatchDictionary(template_path, output_paths)
print(result)

Run the code above in your browser using DataLab