From 41ddd9837f1c6be0b937337c689797b6297d5ca7 Mon Sep 17 00:00:00 2001 From: mhpob Date: Sat, 11 May 2024 14:37:44 +0000 Subject: [PATCH 1/2] Update documentation --- man/summarize_detections.Rd | 117 +++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 54 deletions(-) diff --git a/man/summarize_detections.Rd b/man/summarize_detections.Rd index e0cbde40..76bf76ea 100644 --- a/man/summarize_detections.Rd +++ b/man/summarize_detections.Rd @@ -137,60 +137,69 @@ the output summary. } \examples{ -#get path to example detection file - det_file <- system.file("extdata", "walleye_detections.csv", - package = "glatos") - det <- read_glatos_detections(det_file) - - #Basic summaries - - # by animal - ds <- summarize_detections(det) - - # by location - ds <- summarize_detections(det, summ_type = "location") - - # by animal and location - ds <- summarize_detections(det, summ_type = "both") - - - #Include user-defined location_col - - # by animal - det$some_place <- ifelse(grepl("^S", det$glatos_array), "s", "not_s") - - ds <- summarize_detections(det, location_col = "some_place") - - # by location - ds <- summarize_detections(det, location_col = "some_place", - summ_type = "location") - - # by animal and location - ds <- summarize_detections(det, location_col = "some_place", - summ_type = "both") - - - #Include locations where no animals detected - - #get example receiver data - rec_file <- system.file("extdata", "sample_receivers.csv", - package = "glatos") - rec <- read_glatos_receivers(rec_file) - - ds <- summarize_detections(det, receiver_locs = rec, summ_type = "location") - - - #Include animals that were not detected - #get example animal data from walleye workbook - wb_file <- system.file("extdata", "walleye_workbook.xlsm", - package = "glatos") - wb <- read_glatos_workbook(wb_file) - - ds <- summarize_detections(det, animals = wb$animals, summ_type = "animal") - - #Include by animals and locations that were not detected - ds <- summarize_detections(det, receiver_locs = rec, animals = wb$animals, - summ_type = "both") +# get path to example detection file +det_file <- system.file("extdata", "walleye_detections.csv", + package = "glatos" +) +det <- read_glatos_detections(det_file) + +# Basic summaries + +# by animal +ds <- summarize_detections(det) + +# by location +ds <- summarize_detections(det, summ_type = "location") + +# by animal and location +ds <- summarize_detections(det, summ_type = "both") + + +# Include user-defined location_col + +# by animal +det$some_place <- ifelse(grepl("^S", det$glatos_array), "s", "not_s") + +ds <- summarize_detections(det, location_col = "some_place") + +# by location +ds <- summarize_detections(det, + location_col = "some_place", + summ_type = "location" +) + +# by animal and location +ds <- summarize_detections(det, + location_col = "some_place", + summ_type = "both" +) + + +# Include locations where no animals detected + +# get example receiver data +rec_file <- system.file("extdata", "sample_receivers.csv", + package = "glatos" +) +rec <- read_glatos_receivers(rec_file) + +ds <- summarize_detections(det, receiver_locs = rec, summ_type = "location") + + +# Include animals that were not detected +# get example animal data from walleye workbook +wb_file <- system.file("extdata", "walleye_workbook.xlsm", + package = "glatos" +) +wb <- read_glatos_workbook(wb_file) + +ds <- summarize_detections(det, animals = wb$animals, summ_type = "animal") + +# Include by animals and locations that were not detected +ds <- summarize_detections(det, + receiver_locs = rec, animals = wb$animals, + summ_type = "both" +) } \author{ From 2816146e57e4c3299c8acb1747006750d11f80f3 Mon Sep 17 00:00:00 2001 From: Mike O'Brien Date: Mon, 13 May 2024 15:17:47 -0400 Subject: [PATCH 2/2] remove units dependency --- DESCRIPTION | 1 - R/vis-make_transition3.r | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7dc6ebb3..3ba82b60 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -25,7 +25,6 @@ Imports: sp, tibble, tidyr, - units, zip Suggests: gganimate, diff --git a/R/vis-make_transition3.r b/R/vis-make_transition3.r index 14f8cef7..069464b2 100644 --- a/R/vis-make_transition3.r +++ b/R/vis-make_transition3.r @@ -193,7 +193,7 @@ make_transition3 <- function(poly, res = c(0.1, 0.1), receiver_points = NULL, ep recs_gl <- sf::st_transform(receiver_points, crs = epsg) # determine shortest distance from receiver to water polygon - dist_rec <- units::drop_units(sf::st_distance(recs_gl, poly_gl)) + dist_rec <- as.matrix(sf::st_distance(recs_gl, poly_gl)) recs_gl$rec_water_dist <- apply(dist_rec, 1, "min") # extract rec_water_dist > 0