Skip to contents

Create a formatted table of quality control completeness checks

Usage

tabMWRcom(
  res = NULL,
  frecom = NULL,
  fset = NULL,
  runchk = TRUE,
  warn = TRUE,
  pass_col = "#57C4AD",
  fail_col = "#DB4325",
  digits = 0,
  suffix = "%",
  parameterwd = 1.15,
  noteswd = 3
)

Arguments

res

character string of path to the results file or data.frame for results returned by readMWRresults

frecom

character string of path to the data quality objectives file for frequency and completeness or data.frame returned by readMWRfrecom

fset

optional list of inputs with elements named res, acc, frecom, sit, or wqx overrides the other arguments

runchk

logical to run data checks with checkMWRresults and checkMWRfrecom, applies only if res or frecom are file paths

warn

logical to return warnings to the console (default)

pass_col

character string (as hex code) for the cell color of checks that pass

fail_col

character string (as hex code) for the cell color of checks that fail

digits

numeric indicating number of significant digits to report for percentages

suffix

character string indicating suffix to append to percentage values

parameterwd

numeric indicating width of the parameter column

noteswd

numeric indicating width of notes column

Value

A flextable object with formatted results showing summary counts for all completeness checks for each parameter.

Details

The function can be used with inputs as paths to the relevant files or as data frames returned by readMWRresults and readMWRfrecom. For the former, the full suite of data checks can be evaluated with runkchk = T (default) or suppressed with runchk = F, as explained in the relevant help files. In the latter case, downstream analyses may not work if data are formatted incorrectly. For convenience, a named list with the input arguments as paths or data frames can be passed to the fset argument instead. See the help file for utilMWRinput.

Also note that completeness is only evaluated on parameters that are shared between the results file and data quality objectives file for frequency and completeness. A warning is returned for parameters that do not match between the files. This warning can be suppressed by setting warn = FALSE.

A summary table showing the number of data records, number of qualified records, and percent completeness is created. The % Completeness column shows cells as green or red if the required percentage of observations for completeness are present as specified in the data quality objectives file. The Hit/ Miss column shows similar information but in text format, i.e., MISS is shown if the quality control standard for completeness is not met.

Inputs for the results and data quality objectives for frequency and completeness are processed internally with qcMWRcom and the same arguments are accepted for this function, in addition to others listed above.

Examples

##
# using file paths

# results path
respth <- system.file('extdata/ExampleResults.xlsx', package = 'MassWateR')

# frequency and completeness path
frecompth <- system.file('extdata/ExampleDQOFrequencyCompleteness.xlsx', 
     package = 'MassWateR')

tabMWRcom(res = respth, frecom = frecompth)
#> Running checks on results data...
#> 	Checking column names... OK
#> 	Checking all required columns are present... OK
#> 	Checking valid Activity Types... OK
#> 	Checking Activity Start Date formats... OK
#> 	Checking depth data present... OK
#> 	Checking for non-numeric values in Activity Depth/Height Measure... OK
#> 	Checking Activity Depth/Height Unit... OK
#> 	Checking Activity Relative Depth Name formats... OK
#> 	Checking values in Activity Depth/Height Measure > 1 m / 3.3 ft... OK
#> 	Checking Characteristic Name formats... OK
#> 	Checking Result Values... OK
#> 	Checking for non-numeric values in Quantitation Limit... OK
#> 	Checking QC Reference Values... OK
#> 	Checking for missing entries for Result Unit... OK
#> 	Checking if more than one unit per Characteristic Name... OK
#> 	Checking acceptable units for each entry in Characteristic Name... OK
#> 
#> All checks passed!
#> Running checks on data quality objectives for frequency and completeness...
#> 	Checking column names... OK
#> 	Checking all required columns are present... OK
#> 	Checking for non-numeric values... OK
#> 	Checking for values outside of 0 and 100... OK
#> 	Checking Parameter formats... OK
#> 	Checking empty columns... OK
#> 
#> All checks passed!

Parameter

Number of Data Records

Number of Qualified Records

% Completeness

Hit/ Miss

Number of Censored Records

Notes

Ammonia

43

0

100%

DO

49

0

100%

E.coli

12

0

100%

Nitrate

20

0

100%

Sp Conductance

49

0

100%

TP

48

5

90%

MISS

Water Temp

49

0

100%

pH

49

0

100%

## # using data frames # results data resdat <- readMWRresults(respth) #> Running checks on results data... #> Checking column names... OK #> Checking all required columns are present... OK #> Checking valid Activity Types... OK #> Checking Activity Start Date formats... OK #> Checking depth data present... OK #> Checking for non-numeric values in Activity Depth/Height Measure... OK #> Checking Activity Depth/Height Unit... OK #> Checking Activity Relative Depth Name formats... OK #> Checking values in Activity Depth/Height Measure > 1 m / 3.3 ft... OK #> Checking Characteristic Name formats... OK #> Checking Result Values... OK #> Checking for non-numeric values in Quantitation Limit... OK #> Checking QC Reference Values... OK #> Checking for missing entries for Result Unit... OK #> Checking if more than one unit per Characteristic Name... OK #> Checking acceptable units for each entry in Characteristic Name... OK #> #> All checks passed! # frequency and completeness data frecomdat <- readMWRfrecom(frecompth) #> Running checks on data quality objectives for frequency and completeness... #> Checking column names... OK #> Checking all required columns are present... OK #> Checking for non-numeric values... OK #> Checking for values outside of 0 and 100... OK #> Checking Parameter formats... OK #> Checking empty columns... OK #> #> All checks passed! tabMWRcom(res = resdat, frecom = frecomdat)

Parameter

Number of Data Records

Number of Qualified Records

% Completeness

Hit/ Miss

Number of Censored Records

Notes

Ammonia

43

0

100%

DO

49

0

100%

E.coli

12

0

100%

Nitrate

20

0

100%

Sp Conductance

49

0

100%

TP

48

5

90%

MISS

Water Temp

49

0

100%

pH

49

0

100%