View source: R/checkMWRsites.R
checkMWRsites | R Documentation |
Check site metadata file
checkMWRsites(sitdat)
sitdat |
input data frame |
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
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.
library(dplyr)
sitpth <- system.file('extdata/ExampleSites.xlsx', package = 'MassWateR')
sitdat <- readxl::read_excel(sitpth, na = c('NA', 'na', ''))
checkMWRsites(sitdat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.