I am using rmarkdown and pointblank to generate reports validating data deliverables to be presented to non-R users. I have written several functions to standardize my process for producing a new markdown header followed by a pointblank agent table. However, when I try to produce these header and table combos in mass, the tables do not render correctly. The following image is generated by the code below. Note the Unicode in the "TBL" and "EVAL" columns.
I am guessing this has something to do with knitr::opts_chunk$set( results = 'asis')
, but I cannot figure out how to resolve issue. Any suggestions would be greatly appreciated.
library(pointblank)
data("mtcars")
# List to capture pointblank objects
dat <- list()
# Validate that columns exist
dat$val_names <- create_agent(mtcars) %>%
col_exists(c("mpg", "cyl")) %>%
interrogate()
# Validate columns are numeric
dat$val_class <- create_agent(mtcars) %>%
col_is_numeric(c("mpg", "cyl")) %>%
interrogate()
# Render text asis for markdown headers to render correctly in loop below
knitr::opts_chunk$set( results = 'asis')
# Loop over list objects creating a new markdown header and subsequent pointblank agent table.
for (i in c("val_names", "val_class")) {
# Generate a new markdown header
cat("\n\n###", i, "\n\n")
# Produce pointblank agent table
print(dat[[i]])
}