check_ok_selection: Checks the standard output data frame with the OK selection

View source: R/check_ok_selection.R

check_ok_selectionR Documentation

Checks the standard output data frame with the OK selection

Description

Standard checks by performing descriptive statistics of variables in the standard output data frame with OK selection. check_ok_selection is a wrapper for output_rendered.

Usage

check_ok_selection(
  input = system.file("templates", "check_ok_selection.Rmd", package = "OKplan"),
  output_file = paste0("Kontroll av okplan for ", purpose, " ", format(Sys.Date(),
    "%Y%m%d"), ".html"),
  output_dir = NULL,
  data = NULL,
  purpose = NULL,
  plan_aar = as.numeric(format(Sys.Date(), "%Y")) + 1,
  display = "browser",
  ...
)

Arguments

input

[character(1)]
The path to the rmarkdown document with the checks. Defaults to "check_ok_selection.Rmd" in the OKplan.

output_file

[character(1)]
The name of the output file.

output_dir

[character(1)]
The directory to save the output file. Defaults to NULL.

data

[data.frame]
The table with data describing the selection for a OK programme.

purpose

[character(1)]
String with descriptive text to be used in file name and heading of the report.

plan_aar

[numeric(1)]
The year for which the selection is planned. Defaults to next year.

display

[logical(1) | character(1)]
Set "browser" for the default browser or "viewer" for the R studio viewer. ‘TRUE' equals "browser". If 'FALSE', don’t display the results file. Defaults to "browser".

...

Other arguments to be passed to NVIbatch::output_rendered.

Details

Gives descriptive statistics of the OK selection. This should used to check if the number of selected units per category are in accord with the design of the surveillance programme. If any mistakes are found, one must correct in the script that generates the selection.

The check must be performed on a data frame with standardised column names. This is ensured by using column names as defined for "okplan" in OK_column_standards.

The default behavior is to display the resulting html-file in the browser. To save the result in a permanent file, use a permanent directory as input to output_dir. The resulting file can also be sent by email by using additional arguments, see output_rendered.

If checks are missing, are unnecessary or the headings are too cryptic, please contribute to improve the rmarkdown file "check_ok_selection.Rmd", see vignette("Contribute_to_OKplan", package = "OKplan").

Value

Generates an html-file with the results of the checks to be displayed in the browser.

Author(s)

Petter Hopp Petter.Hopp@vetinst.no

Examples

## Not run: 
# Checking OK selection data

purpose = "ok_virus_svin"
plan_aar = 2023

# Check
check_OK_selection(data = okplan_svin,
                   purpose = purpose,
                   plan_aar = plan_aar)

## End(Not run)


NorwegianVeterinaryInstitute/OKplan documentation built on Dec. 20, 2024, 10:41 a.m.