knitr::opts_chunk$set(echo = TRUE)
suppressPackageStartupMessages(library(knitr))
suppressPackageStartupMessages(library(tools))

Data Summary

kable(data.summary)

Quality Checks Summary

spatialChecks <- 0
temporalChecks <- 0
taxonChecks <- 0
otherChecks <- 0

for (question in checks.records) {
    for (check in question$checks) {
        if (grepl("Location", check$check_category)) {
            spatialChecks = spatialChecks + 1
        } else if (grepl("Event", check$check_category)) {
            temporalChecks = temporalChecks + 1
        } else if (grepl("Taxon", check$check_category)) {
            taxonChecks = taxonChecks + 1
        } else {
            otherChecks = otherChecks + 1
        }
    }
}

Checks <-
    c(
        'Taxonomical quality checks',
        'Spatial quality checks',
        'Temporal quality checks',
        'Other quality checks',
        'Total quality checks'
    )
Count <-
    c(
        taxonChecks,
        spatialChecks,
        temporalChecks,
        otherChecks,
        (taxonChecks + spatialChecks + temporalChecks + otherChecks)
    )
check.summary <- data.frame(Checks, Count)
kable(check.summary)

Quality Checks

index <- 1
checkCount <- 1
for (question in checks.records) {
    cat(paste('## ', index, '. ', question$question, '\n',  sep = ''))
    cat('\n')

    cat(paste('Received Response: ', question$answer, '\n', sep = ''))
    cat('\n')

    checkIndex <- 1
    for (check in question$checks) {
        cat(paste(
            '### ',
            'Quality Check ',
            checkCount,
            ': ',
            names(question$checks[checkIndex]),
            sep = ''
        ))
        cat('\n')

        Type <-
            c('Description',
              'Sample Pass Data',
              'Sample Fail Data',
              'Target DwC Field',
              'Check Category',
              'Flagged Records')

        Value <-
            c(
                check$description,
                check$sample_pass_data,
                check$sample_fail_data,
                check$target_dwc_field,
                toTitleCase(check$check_category),
                check$affected_data
            )

        check.data.summary <- data.frame(Type, Value)
        print(kable(check.data.summary))
        cat('\n')
          cat('\n')
        checkIndex <- checkIndex + 1
        checkCount <- checkCount + 1
    }
    index <- index + 1
}

References

Tomer Gueta, Vijay Barve, Thiloshon Nagarajah, Ashwin Agrawal and Carmel Yohay (2018). bdclean: Biodiversity Data Cleaning Workflow. R package version 0.0.6.

R Core Team (2012). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-07-0, URL http://www.R-project.org/



vijaybarve/bdclean documentation built on Oct. 8, 2021, 9:18 p.m.