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

aggregate_detections_feather(
  detections,
  receiver_metadata,
  replace_dict = list(replace_with = list(c("Releasepoint"), c("Sacramento"),
    c("Endpoint")), replace_list = list(c("FR_Gridley_Rel", "FR_Boyds_Rel",
    "FR_Boyds_Rel_Rec"), c("TowerBridge", "I80-50_Br", "ToeDrainBase", "Hwy84Ferry"),
    c("BeniciaE", "BeniciaW", "ChippsE", "ChippsW")))
)

Arguments

detections

A dataframe containing detections information.

receiver_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 Feather River 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("FR_Gridley_Rel","FR_Boyds_Rel","FR_Boyds_Rel_Rec"),
                                            c("TowerBridge","I80-50_Br", 
                                              "ToeDrainBase","Hwy84Ferry"),
                                            c("BeniciaE","BeniciaW", 
                                              "ChippsE","ChippsW" 
                                            )))

# Aggregate detections for Feather River region
aggregated_data <- aggregate_detections_feather(detections_data, receiver_metadata, replace_dict = replacement_dict)
#> Error: object 'receiver_metadata' not found