Replace receiver locations in the detections dataframe with aggregated locations for the Butte region.

aggregate_detections_butte(
  detections,
  receiever_metadata,
  replace_dict = list(replace_with = list(c("Releasepoint"), c("Sacramento"),
    c("Endpoint")), replace_list = list(c("UpperButte_RST_Rel", "UpperButte_RST",
    "UpperButte_SKWY", "SutterBypass_Weir2_RST_Rel", "SutterBypass Weir2 RST"),
    c("TowerBridge", "I80-50_Br", "ToeDrainBase", "Hwy84Ferry"), c("BeniciaE",
    "BeniciaW", "ChippsE", "ChippsW")))
)

Arguments

detections

A dataframe containing detections information.

receiever_metadata

A dataframe containing receiver metadata.

replace_dict

A list specifying receiver locations to aggregate and their aggregated name.

Value

A list containing:

  • A dataframe of detections with replaced receiver locations.

  • A dataframe of aggregated receiver metadata.

Details

This function replaces receiver locations in the detections dataframe with aggregated locations for the Butte region according to the specified replacement dictionary. It aggregates receiver locations into one and calculates the mean River Kilometer (RKM), Latitude, Longitude, and Region for each aggregated location. The function also updates the receiver metadata accordingly.

Examples

# Define replacement dictionary
replacement_dict <- list(replace_with = list(c("Releasepoint"),
                                             c("Sacramento"),
                                             c("Endpoint")),
                         replace_list = list(c("UpperButte_RST_Rel","UpperButte_RST","UpperButte_SKWY",
                                              "SutterBypass_Weir2_RST_Rel","SutterBypass Weir2 RST"),
                                            c("TowerBridge","I80-50_Br",
                                              "ToeDrainBase","Hwy84Ferry"),
                                            c("BeniciaE","BeniciaW",
                                              "ChippsE","ChippsW"
                                            )))

# Aggregate detections for Butte region
aggregated_data <- aggregate_detections_butte(detections_data, receiver_metadata, replace_dict = replacement_dict)
#> Error in eval(expr, envir, enclos): object 'receiver_metadata' not found