checkDictionary {docket}R Documentation

Check if dictionary meets specific requirements.

Description

Verifies that the input dictionary meets the following conditions #'

Usage

checkDictionary(dictionary)

Arguments

dictionary

A data frame where each row represents a flag in the template document and its replacement value

Value

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

Examples

# Path to the sample template included in the package
template_path <- system.file("template_document", "Template.docx", package="docket")

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

# Insert data into the template dictionary
result[1,2] <- Sys.getenv("USERNAME") #Author name
result[2,2] <- as.character(Sys.Date()) # Date report created
result[3,2] <- 123
result[4,2] <- 456
result[5,2] <- 789
result[6,2] <- sum(as.numeric(result[3:5,2]))

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

[Package docket version 1.33 Index]