This function takes a data frame with field observations of wet/dry status and SpC and generates both a confusion matrix for the wet/dry observations and a scatterplot comparing estimated SpC from the STICs to field-measured values.
validate_stic_data(
stic_data,
field_observations,
max_time_diff,
join_cols,
get_SpC,
get_QAQC
)The field_observations data frame with new columns indicating the closest-in-time STIC wetdry classification (wetdry_STIC), SpC measurement (SpC_STIC; only if get_SpC = T), and time difference between the field observation and STIC reading (timediff_min).
classified STIC data frame with the variable names of that produced by classify_wetdry. At a minimum, there must be datetime, condUncal, and wetdry columns, and an SpC column if get_SpC = T.
The input data frame of field observations must include a datetime column (in POSIXct format), as well as a column labeled wetdry consisting of the character strings “wet” or “dry” (as in the processed STIC data itself). Additionally, if field data on SpC was collected (e.g., with a sonde), this should be included as a third column called SpC, and units should be in µS/cm.
Maximum allowed time difference (in minutes) between field observation and STIC reading to be counted as a match.
A named vector of columns that need to be matched between stic_data and field_observations in addition to datetime. This could include, for instance, a column specifying the site at which the observation was collected. Should be in the format of c("col_name_in_stic_data" = "col_name_in_field_observations") and can have as many columns as desired. If there are no additional columns to be matched, set to NULL.
Logical flag whether to get STIC data for SpC (T) or not (T). You must have an SpC column in stic_data and field_observations if this is used.
Logical flag whether to get the STIC QAQC data (T) or not (T). You must have an QAQC column in both stic_data if this is used.
stic_validation <-
validate_stic_data(
stic_data = classified_df,
field_observations = field_obs,
max_time_diff = 30,
join_cols = NULL,
get_SpC = TRUE,
get_QAQC = FALSE
)
Run the code above in your browser using DataLab