```r}, include=F} library(knitr) library(dplyr) library(PMDatR)
opts_chunk$set(error=TRUE) knit_hooks$set(error = function(x, options) print(PMDatR:::reinterpret_errors(x))) knit_hooks$set(warning = function(x,options)print(PMDatR:::reinterpret_errors(x)))
```r}, echo=F, results='asis', comment=NA} if(exists("ii")){ cat("## Header Processing\n\n") if(any(ii)){ cat("There were problems in the header hook:\n\n") evaluate::replay(res[ii]) } else { cat("Header hook was processed without problems.\n\n") } }
```r}, echo=F, results='asis'}
if(!dom$valid){ cat(sprintf("### Errors in Domain Settings: %s\n", dom$name)) cat(sapply(dom$errors,toString),sep="\n\n") cat("\n\n") knitr::knit_exit() }
```r}, echo=F, results='asis'} # if failed to load if(!dom$Loaded){ cat(sprintf("### Domain failed to load due to errors: %s\n", dom$name)) cat(sapply(dom$errors,toString),sep="\n\n") cat("\n\n") knitr::knit_exit() }
```r}, echo=F, results='asis'} if(!is.null(dom$ChangedMappings)){ if(nrow(dom$ChangedMappings)){ cat(sprintf("### Mappings Changed from %s Mapping\n\n", dom$Mapping)) print(kable(dom$ChangedMappings %>% rename_(.dots=setNames(c("map1","map2"), c(dom$Mapping, "Actual") ) ), "markdown")) cat("'.' indicates a setting that is missing.\n\n") } } else { cat(sprintf("### No Default Mappings for Domain %s in Mapping %s\n\n", dom$MappedDomain, dom$Mapping)) }
Domain loaded: `r dom$Loaded` Source File: `r dom$filepath` [`r dom$in.info$nrow` x `r dom$in.info$ncol`] MD5 sum: `r dom$in.info$md5` File Size: `r format(structure(dom$in.info$size, class="object_size"), units="auto")` Last Modified: `r dom$in.info$mtime` Loaded Data: [`r dom$out.info$nrow` x `r dom$out.info$ncol`] at `r dom$out.info$timestamp` Records removed: `r dom$in.info$nrow - dom$out.info$nrow` by filter `r dom$InputMappings$Filter` ## Domain Summary This table of metadata displays the column names and types as well as the "Range" of the data. For categorical columns all unique values are shown in Range. For text or unknown column types, only the first few unique values are shown. ```r}, echo=F} kable(as.data.frame(dom$outMeta), "markdown")
```r}, echo=F, results='asis'} diagnostics = diagnostics.domain(dom)
if(!is.null(diagnostics)){ cat(paste(unlist(diagnostics), collapse="\n\n"))
} else{ cat("Diagnostics failed to run \n") }
## Domain Data The structure of the loaded data is shown here. ```r}, echo=F} kable(head(dom$Data))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.