checkMWRsites: Check site metadata file

View source: R/checkMWRsites.R

checkMWRsitesR Documentation

Check site metadata file

Description

Check site metadata file

Usage

checkMWRsites(sitdat)

Arguments

sitdat

input data frame

Details

This function is used internally within readMWRsites to run several checks on the input data for completeness and conformance to WQX requirements

The following checks are made:

  • Column name spelling: Should be the following: Monitoring Location ID, Monitoring Location Name, Monitoring Location Latitude, Monitoring Location Longitude, Location Group

  • Columns present: All columns from the previous check should be present

  • Missing longitude or latitude: No missing entries in Monitoring Location Latitude or Monitoring Location Longitude

  • Non-numeric latitude values: Values entered in Monitoring Location Latitude must be numeric

  • Non-numeric longitude values: Values entered in Monitoring Location Longitude must be numeric

  • Positive longitude values: Values in Monitoring Location Longitude must be negative

  • Missing Location ID: No missing entries for Monitoring Location ID

Value

sitdat is returned as is if no errors are found, otherwise an informative error message is returned prompting the user to make the required correction to the raw data before proceeding.

Examples

library(dplyr)

sitpth <- system.file('extdata/ExampleSites.xlsx', package = 'MassWateR')

sitdat <- readxl::read_excel(sitpth, na = c('NA', 'na', ''))
    
checkMWRsites(sitdat)

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