Skip to contents

After retrieving multiple result and metadata profiles from the WQP, this function joins those profiles together into one dataframe. The FullPhysChem data input is required to run this function.

Usage

TADA_JoinWQPProfiles(FullPhysChem = "null", Sites = "null", Projects = "null")

Arguments

FullPhysChem

Full physical chemical data profile

Sites

Sites data profile

Projects

Projects data profile

Value

TADA-compatible dataframe

Details

The WQP user interface assists users with constructing a web service query URL - for example: https://www.waterqualitydata.us/#statecode=US%3A09& characteristicType=Nutrient&startDateLo=04-01-2023& startDateHi=11-01-2023&mimeType=csv&providers=NWIS&providers=STEWARDS& providers=STORET

Examples

if (FALSE) { # \dontrun{
# Define base URL and common components
baseurl <- "https://www.waterqualitydata.us"
filters <- "/search?statecode=US%3A09&characteristicType=Nutrient"
dates <- "&startDateLo=04-01-2023&startDateHi=11-01-2023"
type <- "&mimeType=csv&zip=yes"
providers <- "&providers=NWIS&providers=STEWARDS&providers=STORET"

# Construct URLs for different profiles
station_url <- paste0(baseurl, "/data/Station", filters, dates, type, providers)
result_url <- paste0(
  baseurl, "/data/Result", filters,
  dates, type, "&dataProfile=resultPhysChem", providers
)
project_url <- paste0(baseurl, "/data/Project", filters, dates, type, providers)

# Retrieve data from Water Quality Portal web services
stationProfile <- TADA_ReadWQPWebServices(station_url)
physchemProfile <- TADA_ReadWQPWebServices(result_url)
projectProfile <- TADA_ReadWQPWebServices(project_url)

# Join all three profiles using TADA_JoinWQPProfiles
TADAProfile <- TADA_JoinWQPProfiles(
  FullPhysChem = physchemProfile,
  Sites = stationProfile,
  Projects = projectProfile
)
} # }