tabMWRcom {MassWateR} | R Documentation |
Create a formatted table of quality control completeness checks
Description
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 |
frecom |
character string of path to the data quality objectives file for frequency and completeness or |
fset |
optional list of inputs with elements named |
runchk |
logical to run data checks with |
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 |
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.
Value
A flextable
object with formatted results showing summary counts for all completeness checks for each parameter.
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)
##
# using data frames
# results data
resdat <- readMWRresults(respth)
# frequency and completeness data
frecomdat <- readMWRfrecom(frecompth)
tabMWRcom(res = resdat, frecom = frecomdat)