checkBatchDictionary {docket}R Documentation

Check that the batch dictionary is valid

Description

Validates that the input batch dictionary meets the following requirements: #' #'

Usage

checkBatchDictionary(batchDictionary)

Arguments

batchDictionary

A data frame where each row represents a flag to be replaced in the template document and each column represents a final document to be generated

Value

Logical. Returns 'TRUE' if the batch dictionary meets requirements for processing. Returns 'FALSE' otherwise

Examples

# 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)
result[2,2:ncol(result)] <- Sys.getenv("USERNAME") #Author name
result[3,2:ncol(result)] <- as.character(Sys.Date())
result[4,2:ncol(result)] <- 123
result[5,2:ncol(result)] <- 456
result[6,2:ncol(result)] <- 789
result[7,2:ncol(result)] <- sum(as.numeric(result[4:6,2]))

# Verify that the result dictionary is valid
if (checkBatchDictionary(result) == TRUE) {
  print("Valid Batch Dictionary")
}

[Package docket version 1.33 Index]