diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 8d60ca8..dd147dc 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -6,6 +6,10 @@ on: pull_request: branches: [main, dev] +concurrency: + group: rcmdcheck-${{ github.ref }} + cancel-in-progress: true + name: R-CMD-check jobs: @@ -46,4 +50,5 @@ jobs: - uses: r-lib/actions/check-r-package@v2 with: + error-on: '"note"' upload-snapshots: true diff --git a/.github/workflows/style.yaml b/.github/workflows/style.yaml index 66958a4..6f1682d 100644 --- a/.github/workflows/style.yaml +++ b/.github/workflows/style.yaml @@ -3,6 +3,8 @@ on: push: paths: ["**.[rR]", "**.[qrR]md", "**.[rR]markdown", "**.[rR]nw", "**.[rR]profile"] + pull_request: + paths: ["**.[rR]", "**.[qrR]md", "**.[rR]markdown", "**.[rR]nw", "**.[rR]profile"] name: Style diff --git a/DESCRIPTION b/DESCRIPTION index 87fd428..74c4848 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: otndo Title: Understand your OTN data -Version: 0.2.2 +Version: 0.2.3.9000 Authors@R: person("Michael", "O'Brien", , "mike@obrien.page", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-1420-6395")) diff --git a/NEWS.md b/NEWS.md index 0669ba8..9cd91cd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,7 @@ ## otndo 0.2 +### v 0.2.3 +* Switched from using the `mapview` package for interactive maps to `leaflet` and `leaflet_legend`. Thanks to [@joyliujoyliu](https://github.com/joyliujoyliu) for their work here! + ### v 0.2.2 * Fixed behavior where `clean_otn_deployment` would return different columns if there was no internal transmitter logged. [Issue #10](https://github.com/mhpob/otndo/issues/10); [d58e2d4](https://github.com/mhpob/otndo/pull/31/commits/d58e2d46e05aed7ba4acc08b8d02672b28d79804) * Add internal function (`convert_times`) that checks for Excel-formatted date-times and converts accordingly [f13f360](https://github.com/mhpob/otndo/pull/31/commits/f13f360fe5e4438b6ba668039a6c94f04eeafe60) diff --git a/R/leaflet_graph.R b/R/leaflet_graph.R index fdafec9..ac21727 100644 --- a/R/leaflet_graph.R +++ b/R/leaflet_graph.R @@ -1,36 +1,44 @@ #' Plot the leaflet graphs for detection and individual -#' @param station_spatial is created by prep_station_spatial,which is a spatial object with the geometry +#' +#' @param station_spatial sf spatial data/frame created by prep_station_spatial +#' #' @export leaflet_graph <- function(station_spatial) { - geometry<- NULL - df <- station_spatial |> tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.*)\\)', convert = TRUE) - numPal <- leaflet::colorNumeric('viridis', df $Detections) + geometry <- NULL + df <- station_spatial |> tidyr::extract(geometry, c("lon", "lat"), "\\((.*), (.*)\\)", convert = TRUE) + numPal <- leaflet::colorNumeric("viridis", df$Detections) leaflet::leaflet(data = df) |> leaflet::addTiles() |> - leaflet::addCircleMarkers( lat = ~lat, lng = ~lon, - color= 'black', fillColor = ~numPal(df$Detections),fillOpacity = 0.7, - popup = paste("Station ", df$station , "
", - "PI:", df$PI, "
", - "Detections:", df$Detections, "
", - "detectedby:", df$detectedby, "
", - "Individuals:", df$Individuals), - radius = ~(df$Individuals)) |> - + leaflet::addCircleMarkers( + lat = ~lat, lng = ~lon, + color = "black", + fillColor = ~ numPal(Detections), + fillOpacity = 0.7, + popup = paste( + "Station ", df$station, "
", + "PI:", df$PI, "
", + "Detections:", df$Detections, "
", + "detectedby:", df$detectedby, "
", + "Individuals:", df$Individuals + ), + radius = ~ Individuals + ) |> leaflegend::addLegendSize( - values = df $Individuals, + values = df$Individuals, baseSize = 5, - color = 'black', - title = 'Individual', - shape = 'circle', - orientation = 'horizontal', - opacity = .5, + color = "black", + title = "Individual", + shape = "circle", + orientation = "horizontal", + opacity = 0.5, fillOpacity = 0, breaks = 5, - position = 'bottomright') |> + position = "bottomright" + ) |> leaflegend::addLegendNumeric( pal = numPal, - title = 'Matched Detection', + title = 'Matched Detections', values = df$Detections, fillOpacity = .5, decreasing = FALSE, @@ -38,9 +46,6 @@ leaflet_graph <- function(station_spatial) { shape = 'rect', position = 'bottomright', height = 20, - width = 100) - - - + width = 100 + ) } - diff --git a/R/match_table.R b/R/match_table.R index 6f9980d..37f3488 100644 --- a/R/match_table.R +++ b/R/match_table.R @@ -6,6 +6,9 @@ #' #' @examples #' \dontrun{ +#' td <- file.path(tempdir(), "matos_test_files") +#' dir.create(td) +#' #' # Receiver #' download.file( #' paste0( diff --git a/R/matched_abacus.R b/R/matched_abacus.R index 103b164..fb5848f 100644 --- a/R/matched_abacus.R +++ b/R/matched_abacus.R @@ -6,6 +6,9 @@ #' #' @examples #' \dontrun{ +#' td <- file.path(tempdir(), "matos_test_files") +#' dir.create(td) +#' #' # Get a detection file #' download.file( #' paste0( diff --git a/R/prep_station_spatial.R b/R/prep_station_spatial.R index 2de07ad..78cb077 100644 --- a/R/prep_station_spatial.R +++ b/R/prep_station_spatial.R @@ -5,6 +5,9 @@ #' #' @examples #' \dontrun{ +#' td <- file.path(tempdir(), "matos_test_files") +#' dir.create(td) +#' #' # Get an extract file #' download.file( #' paste0( diff --git a/R/remaining_transmitters.R b/R/remaining_transmitters.R index b4944c8..4f12541 100644 --- a/R/remaining_transmitters.R +++ b/R/remaining_transmitters.R @@ -13,7 +13,7 @@ #' #' @examples #' \dontrun{ -#' #' # Set up example data +#' # Set up example data #' td <- file.path(tempdir(), "otndo_example") #' dir.create(td) #'