utilMWRsheet: Format a list of QC tables for spreadsheet export

View source: R/utilMWRsheet.R

utilMWRsheetR Documentation

Format a list of QC tables for spreadsheet export

Description

Format a list of QC tables for spreadsheet export

Usage

utilMWRsheet(datin, rawdata = TRUE)

Arguments

datin

list of input QC tables

rawdata

logical to include quality control accuracy summaries for raw data, e.g., field blanks, etc.

Details

The function is used internally with qcMWRreview to format data quality objective and quality control tables for export into an Excel spreadsheet. These changes are specific to the spreadsheet format and may not reflect the formatting in the Word document produced by qcMWRreview.

The datin list is expected to contain the following elements:

  • frecomdat Data Quality Objectives for frequency and completeness data frame as returned by readMWRfrecom

  • accdat Data Quality Objectives for accuracy data frame as returned by readMWRacc

  • tabfreper Frequency checks percent table, created with tabMWRfre

  • tabfresum Frequency checks summary table, created with tabMWRfre

  • tabaccper Accuracy checks percent table, created with tabMWRacc

  • tabaccsum Accuracy checks summary table, created with tabMWRacc

  • tabcom Completeness table, created with tabMWRcom

  • indflddup Individual accuracy checks table for field duplicates, created with tabMWRacc, can be NULL

  • indlabdup Individual accuracy checks table for lab duplicates, created with tabMWRacc, can be NULL

  • indfldblk Individual accuracy checks table for field blanks, created with tabMWRacc, can be NULL

  • indlabblk Individual accuracy checks table for lab blanks, created with tabMWRacc, can be NULL

  • indlabins Individual accuracy checks table for lab spikes and instrument checks, created with tabMWRacc, can be NULL

Value

A list similar to the input with formatting applied

Examples

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

# dqo accuracy data path
accpth <- system.file('extdata/ExampleDQOAccuracy.xlsx', package = 'MassWateR')

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

# censored data path
censpth <- system.file('extdata/ExampleCensored.xlsx', package = 'MassWateR')

# results data
resdat <- readMWRresults(respth)

# accuracy data
accdat <- readMWRacc(accpth)

# frequency and completeness data
frecomdat <- readMWRfrecom(frecompth)

# censored data
censdat <- readMWRcens(censpth)

# frequency table percent
tabfreper <- tabMWRfre(res = resdat, acc = accdat, frecom = frecomdat, type = 'percent', 
  warn = FALSE) 

# frequency summary table
tabfresum <- tabMWRfre(res = resdat, acc = accdat, frecom = frecomdat, type = 'summary', 
  warn = FALSE)

# accuracy table percent
tabaccper <- tabMWRacc(res = resdat, acc = accdat, frecom = frecomdat, type = 'percent', 
  warn = FALSE)

# accuracy table summary
tabaccsum <- tabMWRacc(res = resdat, acc = accdat, frecom = frecomdat, type = 'summary', 
  warn = FALSE)
  
# completeness table
tabcom <- tabMWRcom(res = resdat, frecom = frecomdat, cens = censdat, warn = FALSE, 
  parameterwd = 1.15, noteswd = 2)

# individual accuracy checks for raw data
indflddup <- tabMWRacc(res = resdat, acc = accdat, frecom = frecomdat, type = 'individual', 
  accchk = 'Field Duplicates', warn = FALSE, caption = FALSE)
indlabdup <- tabMWRacc(res = resdat, acc = accdat, frecom = frecomdat, type = 'individual', 
  accchk = 'Lab Duplicates', warn = FALSE, caption = FALSE)
indfldblk <- tabMWRacc(res = resdat, acc = accdat, frecom = frecomdat, type = 'individual', 
  accchk = 'Field Blanks', warn = FALSE, caption = FALSE)
indlabblk <- tabMWRacc(res = resdat, acc = accdat, frecom = frecomdat, type = 'individual', 
  accchk = 'Lab Blanks', warn = FALSE, caption = FALSE)
indlabins <- tabMWRacc(res = resdat, acc = accdat, frecom = frecomdat, type = 'individual', 
  accchk = 'Lab Spikes / Instrument Checks', warn = FALSE, caption = FALSE)

# input  
datin <- list(
  frecomdat = frecomdat, 
  accdat = accdat,
  tabfreper = tabfreper,
  tabfresum = tabfresum,
  tabaccper = tabaccper,
  tabaccsum = tabaccsum,
  tabcom = tabcom,
  indflddup = indflddup,
  indlabdup = indlabdup,
  indfldblk = indfldblk,
  indlabblk = indlabblk,
  indlabins = indlabins
)

utilMWRsheet(datin)

massbays-tech/MassWateR documentation built on April 12, 2025, 7:53 p.m.