From 10080ef9a51b770fd9b6a5804b44cc8f2512d3db Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Fri, 7 Jun 2024 16:27:01 -0300
Subject: [PATCH 01/59] use leaflet in Fig
---
inst/qmd_template/make_tag_push_summary.qmd | 41 ++++++++++++++++++++-
1 file changed, 40 insertions(+), 1 deletion(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 225a653..a4e14a6 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -29,6 +29,7 @@ library(sf)
library(mapview)
library(ggplot2)
library(reactable)
+library(leaflet)
```
@@ -603,13 +604,51 @@ station_spatial <- station_spatial[, .(station, Detections, Individuals, PI, Pro
```
```{r}
+# Make another label for individual
#| label: new-detection-map-leaflet
-#| fig-cap: Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, while size and color reflect the number of detections at that location.
+#| fig-cap: Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where color reflects the number of detections and size reflects the number of fish at that location.
+#|
mapview::mapview(station_spatial,
zcol = "Detections",
cex = "Individuals",
layer.name = "Matched detections"
)
+
+# I find mapview has limitations in legend and it cannot show the size values. Here I use leaflet
+
+numPal <- colorNumeric('viridis', station_spatial$Detections)
+leaflet(station_spatial) %>%
+ addTiles() %>%
+ addSymbolsSize(values = ~Individuals,
+ lat = ~ latitude,
+ lng = ~longitude,
+ shape = 'plus',
+ color = 'black',
+ fillColor = ~numPal(Detections),
+ opacity = .5,
+ baseSize = 10) %>%
+ addLegendSize(
+ values = station_spatial$Individuals,
+ color = 'black',
+ title = 'Individual',
+ shape = 'plus',
+ orientation = 'horizontal',
+ opacity = .5,
+ fillOpacity = 0,
+ breaks = 5,
+ position = 'bottomright') %>%
+ addLegendNumeric(
+ pal = numPal,
+ title = 'Matched Detection',
+ shape = 'circle',
+ values = station_spatial$Detections,
+ fillOpacity = .5,
+ decreasing = TRUE,
+ position = 'bottomright')
+
+
+
+
```
```{r results='asis', echo=FALSE}
From 046ba9de2be5b40fba7fcd7b6f0c09b3d579098a Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Mon, 10 Jun 2024 11:00:58 -0300
Subject: [PATCH 02/59] lefleat
---
inst/qmd_template/make_tag_push_summary.qmd | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index a4e14a6..09156d7 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -608,11 +608,7 @@ station_spatial <- station_spatial[, .(station, Detections, Individuals, PI, Pro
#| label: new-detection-map-leaflet
#| fig-cap: Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where color reflects the number of detections and size reflects the number of fish at that location.
#|
-mapview::mapview(station_spatial,
- zcol = "Detections",
- cex = "Individuals",
- layer.name = "Matched detections"
-)
+
# I find mapview has limitations in legend and it cannot show the size values. Here I use leaflet
From d1f3be840988c77c75af48941b4040cd2abf67ab Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Mon, 10 Jun 2024 12:29:42 -0300
Subject: [PATCH 03/59] l
---
inst/qmd_template/make_tag_push_summary.qmd | 36 +++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 7879cf7..9958e87 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -228,6 +228,42 @@ reactable(station_summary)
#| fig-cap: Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where color reflects the number of detections and size reflects the number of fish at that location.
#|
+# I find mapview has limitations in legend and it cannot show the size values. Here I use leaflet
+
+numPal <- colorNumeric('viridis', station_spatial$Detections)
+leaflet(station_spatial) %>%
+ addTiles() %>%
+ addSymbolsSize(values = ~Individuals,
+ lat = ~ latitude,
+ lng = ~longitude,
+ shape = 'plus',
+ color = 'black',
+ fillColor = ~numPal(Detections),
+ opacity = .5,
+ baseSize = 10) %>%
+ addLegendSize(
+ values = station_spatial$Individuals,
+ color = 'black',
+ title = 'Individual',
+ shape = 'plus',
+ orientation = 'horizontal',
+ opacity = .5,
+ fillOpacity = 0,
+ breaks = 5,
+ position = 'bottomright') %>%
+ addLegendNumeric(
+ pal = numPal,
+ title = 'Matched Detection',
+ shape = 'circle',
+ values = station_spatial$Detections,
+ fillOpacity = .5,
+ decreasing = TRUE,
+ position = 'bottomright')
+
+
+
+
+
```
From a384c25188ff5927b2f2c92e854d09abd8d1a12d Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Mon, 10 Jun 2024 13:11:51 -0300
Subject: [PATCH 04/59] addLegendNumeric is not working
---
inst/qmd_template/make_tag_push_summary.qmd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 9958e87..1856c0c 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -251,7 +251,7 @@ leaflet(station_spatial) %>%
fillOpacity = 0,
breaks = 5,
position = 'bottomright') %>%
- addLegendNumeric(
+ addLegend(
pal = numPal,
title = 'Matched Detection',
shape = 'circle',
From 7bf6e10658365a90b139d3ecd28f58a5700a95b6 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Mon, 10 Jun 2024 13:20:15 -0300
Subject: [PATCH 05/59] leaflegend
---
inst/qmd_template/make_tag_push_summary.qmd | 1 +
1 file changed, 1 insertion(+)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 1856c0c..2feb009 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -29,6 +29,7 @@ library(data.table)
library(mapview)
library(reactable)
library(leaflet)
+library(leaflegend)
```
From 1641712286fe4925f708b433b725838f309d431d Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Mon, 10 Jun 2024 13:22:51 -0300
Subject: [PATCH 06/59] addLegendNumeric
---
inst/qmd_template/make_tag_push_summary.qmd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 2feb009..9224c1b 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -252,7 +252,7 @@ leaflet(station_spatial) %>%
fillOpacity = 0,
breaks = 5,
position = 'bottomright') %>%
- addLegend(
+ addLegendNumeric(
pal = numPal,
title = 'Matched Detection',
shape = 'circle',
From 138c1b4d14dfe1b25317ed3b4f53d86c23d9d7e1 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Mon, 10 Jun 2024 13:26:14 -0300
Subject: [PATCH 07/59] stadium
---
inst/qmd_template/make_tag_push_summary.qmd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 9224c1b..8fc3dd6 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -255,7 +255,7 @@ leaflet(station_spatial) %>%
addLegendNumeric(
pal = numPal,
title = 'Matched Detection',
- shape = 'circle',
+ shape = 'stadium',
values = station_spatial$Detections,
fillOpacity = .5,
decreasing = TRUE,
From a79e5cca75aaa522ba8386676829f9ec6d781873 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 10:10:49 -0300
Subject: [PATCH 08/59] len
---
inst/qmd_template/make_tag_push_summary.qmd | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 8fc3dd6..69e4628 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -231,9 +231,12 @@ reactable(station_summary)
#|
# I find mapview has limitations in legend and it cannot show the size values. Here I use leaflet
+
+
numPal <- colorNumeric('viridis', station_spatial$Detections)
-leaflet(station_spatial) %>%
+leaflet() %>%
addTiles() %>%
+ addPolygons(data = station_spatial)%>%
addSymbolsSize(values = ~Individuals,
lat = ~ latitude,
lng = ~longitude,
From ba4c57a22b52725795df017ed61e5877d1bf7027 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 10:36:28 -0300
Subject: [PATCH 09/59] geo-> lon, lat
---
inst/qmd_template/make_tag_push_summary.qmd | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 69e4628..ac60cae 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -30,6 +30,7 @@ library(mapview)
library(reactable)
library(leaflet)
library(leaflegend)
+library(tidyr)
```
@@ -231,22 +232,25 @@ reactable(station_summary)
#|
# I find mapview has limitations in legend and it cannot show the size values. Here I use leaflet
+df <- station_spatial %>% extract(geometry, c('lat', 'lon'), '\\((.*), (.*)\\)', convert = TRUE)
-numPal <- colorNumeric('viridis', station_spatial$Detections)
+df %>% as_data_frame()
+
+numPal <- colorNumeric('viridis', df $Detections)
leaflet() %>%
addTiles() %>%
- addPolygons(data = station_spatial)%>%
+ addPolygons(data = df )%>%
addSymbolsSize(values = ~Individuals,
- lat = ~ latitude,
- lng = ~longitude,
+ lat = ~ lat,
+ lng = ~lon,
shape = 'plus',
color = 'black',
fillColor = ~numPal(Detections),
opacity = .5,
baseSize = 10) %>%
addLegendSize(
- values = station_spatial$Individuals,
+ values = df $Individuals,
color = 'black',
title = 'Individual',
shape = 'plus',
@@ -259,7 +263,7 @@ leaflet() %>%
pal = numPal,
title = 'Matched Detection',
shape = 'stadium',
- values = station_spatial$Detections,
+ values = df $Detections,
fillOpacity = .5,
decreasing = TRUE,
position = 'bottomright')
From 4c58922627553a909fa4a29ed7b36d486e89a214 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 10:41:33 -0300
Subject: [PATCH 10/59] s
---
inst/qmd_template/make_tag_push_summary.qmd | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index ac60cae..1c20de3 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -31,6 +31,7 @@ library(reactable)
library(leaflet)
library(leaflegend)
library(tidyr)
+library(tidyverse)
```
@@ -232,10 +233,10 @@ reactable(station_summary)
#|
# I find mapview has limitations in legend and it cannot show the size values. Here I use leaflet
-df <- station_spatial %>% extract(geometry, c('lat', 'lon'), '\\((.*), (.*)\\)', convert = TRUE)
+df <- station_spatial %>% tidyr::extract(geometry, c('lat', 'lon'), '\\((.*), (.*)\\)', convert = TRUE)
-df %>% as_data_frame()
+df %>% as.data.frame()
numPal <- colorNumeric('viridis', df $Detections)
leaflet() %>%
From 524e2f92dc5af0c8124968c07b74e3086441460d Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 10:45:09 -0300
Subject: [PATCH 11/59] data = df
---
inst/qmd_template/make_tag_push_summary.qmd | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 1c20de3..4ab617c 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -239,9 +239,8 @@ df <- station_spatial %>% tidyr::extract(geometry, c('lat', 'lon'), '\\((.*), (.
df %>% as.data.frame()
numPal <- colorNumeric('viridis', df $Detections)
-leaflet() %>%
+leaflet(data = df) %>%
addTiles() %>%
- addPolygons(data = df )%>%
addSymbolsSize(values = ~Individuals,
lat = ~ lat,
lng = ~lon,
From 3d7d02a2496a1f750b891dabc220028ecb90ccf9 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 10:59:03 -0300
Subject: [PATCH 12/59] d
---
inst/qmd_template/make_tag_push_summary.qmd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 4ab617c..c787dab 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -233,7 +233,7 @@ reactable(station_summary)
#|
# I find mapview has limitations in legend and it cannot show the size values. Here I use leaflet
-df <- station_spatial %>% tidyr::extract(geometry, c('lat', 'lon'), '\\((.*), (.*)\\)', convert = TRUE)
+df <- station_spatial %>% tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.*)\\)', convert = TRUE)
df %>% as.data.frame()
From 8e5f404d749421b5160c41adc0cce293ca2e019e Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 12:05:24 -0300
Subject: [PATCH 13/59] s
---
inst/qmd_template/make_tag_push_summary.qmd | 2 ++
1 file changed, 2 insertions(+)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index c787dab..30c9df5 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -238,6 +238,8 @@ df <- station_spatial %>% tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.
df %>% as.data.frame()
+summary(df )
+
numPal <- colorNumeric('viridis', df $Detections)
leaflet(data = df) %>%
addTiles() %>%
From 086417b80d6e0e0deaea07c849090db94f83c228 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 12:13:04 -0300
Subject: [PATCH 14/59] circle
---
inst/qmd_template/make_tag_push_summary.qmd | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 30c9df5..ce82476 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -246,25 +246,25 @@ leaflet(data = df) %>%
addSymbolsSize(values = ~Individuals,
lat = ~ lat,
lng = ~lon,
- shape = 'plus',
+ shape = 'circle',
color = 'black',
fillColor = ~numPal(Detections),
- opacity = .5,
- baseSize = 10) %>%
+ opacity = .1,
+ baseSize = 1) %>%
addLegendSize(
values = df $Individuals,
color = 'black',
title = 'Individual',
- shape = 'plus',
+ shape = 'circle',
orientation = 'horizontal',
- opacity = .5,
+ opacity = .1,
fillOpacity = 0,
- breaks = 5,
+ breaks = 1,
position = 'bottomright') %>%
addLegendNumeric(
pal = numPal,
title = 'Matched Detection',
- shape = 'stadium',
+ shape = 'circle',
values = df $Detections,
fillOpacity = .5,
decreasing = TRUE,
From db557e099f5b9467e6be7ea56c505924c7303474 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 12:17:29 -0300
Subject: [PATCH 15/59] stadium
---
inst/qmd_template/make_tag_push_summary.qmd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index ce82476..568ac34 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -264,7 +264,7 @@ leaflet(data = df) %>%
addLegendNumeric(
pal = numPal,
title = 'Matched Detection',
- shape = 'circle',
+ shape = 'stadium',
values = df $Detections,
fillOpacity = .5,
decreasing = TRUE,
From 609adc5bb4b14e9c4dea786d183f69aed9e1b12e Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 12:23:22 -0300
Subject: [PATCH 16/59] stadium
---
inst/qmd_template/make_tag_push_summary.qmd | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 568ac34..23a606b 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -250,15 +250,15 @@ leaflet(data = df) %>%
color = 'black',
fillColor = ~numPal(Detections),
opacity = .1,
- baseSize = 1) %>%
+ baseSize = 1.5) %>%
addLegendSize(
values = df $Individuals,
color = 'black',
title = 'Individual',
- shape = 'circle',
+ shape = 'stadium',
orientation = 'horizontal',
opacity = .1,
- fillOpacity = 0,
+ fillOpacity = 0.5,
breaks = 1,
position = 'bottomright') %>%
addLegendNumeric(
From 7b204d1bda7b50848c29e751b724978da553fb3a Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 12:38:56 -0300
Subject: [PATCH 17/59] values
---
inst/qmd_template/make_tag_push_summary.qmd | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 23a606b..fa4ab29 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -249,7 +249,7 @@ leaflet(data = df) %>%
shape = 'circle',
color = 'black',
fillColor = ~numPal(Detections),
- opacity = .1,
+ opacity = .5,
baseSize = 1.5) %>%
addLegendSize(
values = df $Individuals,
@@ -257,9 +257,9 @@ leaflet(data = df) %>%
title = 'Individual',
shape = 'stadium',
orientation = 'horizontal',
- opacity = .1,
- fillOpacity = 0.5,
- breaks = 1,
+ opacity = .5,
+ fillOpacity = 0,
+ breaks = 5,
position = 'bottomright') %>%
addLegendNumeric(
pal = numPal,
From ef7db990232d94ff24293328ce3a6ad8618aefc0 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 12:44:58 -0300
Subject: [PATCH 18/59] vLU
---
inst/qmd_template/make_tag_push_summary.qmd | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index fa4ab29..811c027 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -252,14 +252,14 @@ leaflet(data = df) %>%
opacity = .5,
baseSize = 1.5) %>%
addLegendSize(
- values = df $Individuals,
+ values = ((df $Individuals)/10),
color = 'black',
title = 'Individual',
shape = 'stadium',
orientation = 'horizontal',
opacity = .5,
fillOpacity = 0,
- breaks = 5,
+ breaks = 10,
position = 'bottomright') %>%
addLegendNumeric(
pal = numPal,
From 9fb7717756584823148c5b6c08d4012ec158575c Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 12:59:36 -0300
Subject: [PATCH 19/59] baseSize = 1,
---
inst/qmd_template/make_tag_push_summary.qmd | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 811c027..eefe459 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -252,14 +252,15 @@ leaflet(data = df) %>%
opacity = .5,
baseSize = 1.5) %>%
addLegendSize(
- values = ((df $Individuals)/10),
+ values = df $Individuals,
+ baseSize = 1,
color = 'black',
title = 'Individual',
- shape = 'stadium',
+ shape = 'cirle',
orientation = 'horizontal',
opacity = .5,
fillOpacity = 0,
- breaks = 10,
+ breaks = 5,
position = 'bottomright') %>%
addLegendNumeric(
pal = numPal,
From 35ac18d329e1229ccc8fae4a3130cc616a60d46b Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 13:02:16 -0300
Subject: [PATCH 20/59] circle
---
inst/qmd_template/make_tag_push_summary.qmd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index eefe459..e892ced 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -256,7 +256,7 @@ leaflet(data = df) %>%
baseSize = 1,
color = 'black',
title = 'Individual',
- shape = 'cirle',
+ shape = 'circle',
orientation = 'horizontal',
opacity = .5,
fillOpacity = 0,
From b6995cb81ba270199d65c0ff421a8efe7eef2638 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 13:20:14 -0300
Subject: [PATCH 21/59] #| fig-cap-location: top
---
inst/qmd_template/make_tag_push_summary.qmd | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index e892ced..c06c280 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -230,7 +230,8 @@ reactable(station_summary)
#| label: new-detection-map-leaflet
#| fig-cap: Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where color reflects the number of detections and size reflects the number of fish at that location.
-#|
+#| fig-cap-location: top
+
# I find mapview has limitations in legend and it cannot show the size values. Here I use leaflet
df <- station_spatial %>% tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.*)\\)', convert = TRUE)
@@ -238,7 +239,7 @@ df <- station_spatial %>% tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.
df %>% as.data.frame()
-summary(df )
+#summary(df )
numPal <- colorNumeric('viridis', df $Detections)
leaflet(data = df) %>%
From 8730f373930489ce3f2dbfe650e39810846c4c87 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 13:26:56 -0300
Subject: [PATCH 22/59] jgi
---
inst/qmd_template/make_tag_push_summary.qmd | 4 ----
1 file changed, 4 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index c06c280..5e5eb62 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -228,15 +228,11 @@ reactable(station_summary)
```{r}
# Make another label for individual
#| label: new-detection-map-leaflet
-
#| fig-cap: Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where color reflects the number of detections and size reflects the number of fish at that location.
-#| fig-cap-location: top
# I find mapview has limitations in legend and it cannot show the size values. Here I use leaflet
df <- station_spatial %>% tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.*)\\)', convert = TRUE)
-
-
df %>% as.data.frame()
#summary(df )
From 95070f4edfcc4e892434d5644878e6b4224b0e09 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 13:34:37 -0300
Subject: [PATCH 23/59] add cap
---
inst/qmd_template/make_tag_push_summary.qmd | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 5e5eb62..dce5921 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -225,13 +225,9 @@ station_summary <- station_table(new_matches, "tag")
reactable(station_summary)
```
-```{r}
-# Make another label for individual
-#| label: new-detection-map-leaflet
-#| fig-cap: Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where color reflects the number of detections and size reflects the number of fish at that location.
-# I find mapview has limitations in legend and it cannot show the size values. Here I use leaflet
+```{r}
df <- station_spatial %>% tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.*)\\)', convert = TRUE)
df %>% as.data.frame()
@@ -275,6 +271,14 @@ leaflet(data = df) %>%
```
+```{r}
+# Make another label for individual
+# I find mapview has limitations in legend and it cannot show the size values. Here I use leaflet
+#| label: new-detection-map-leaflet
+#| fig-cap: Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where color reflects the number of detections and size reflects the number of fish at that location.
+```
+
+
```{r results='asis', echo=FALSE}
if (is.null(params$since)) {
cat("-->")
From 3a5617cb57f6ce777cdf4755eb63d531a47cbd79 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 13:49:22 -0300
Subject: [PATCH 24/59] add fig
---
inst/qmd_template/make_tag_push_summary.qmd | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index dce5921..8bbf56d 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -225,9 +225,12 @@ station_summary <- station_table(new_matches, "tag")
reactable(station_summary)
```
+```{r, fig.cap="Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where color reflects the number of detections and size reflects the number of fish at that location."}
+# Make another label for individual
+# I find mapview has limitations in legend and it cannot show the size values. Here I use leaflet
+#| label: new-detection-map-leaflet
+#| fig-cap: Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where color reflects the number of detections and size reflects the number of fish at that location.
-
-```{r}
df <- station_spatial %>% tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.*)\\)', convert = TRUE)
df %>% as.data.frame()
@@ -266,17 +269,9 @@ leaflet(data = df) %>%
-
-
-
```
-```{r}
-# Make another label for individual
-# I find mapview has limitations in legend and it cannot show the size values. Here I use leaflet
-#| label: new-detection-map-leaflet
-#| fig-cap: Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where color reflects the number of detections and size reflects the number of fish at that location.
-```
+
```{r results='asis', echo=FALSE}
From dd27a8fe96b1b62a03bfbeb0d07ecb0fb461ac0e Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 14:09:52 -0300
Subject: [PATCH 25/59] summ
---
inst/qmd_template/make_tag_push_summary.qmd | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 8bbf56d..4d95812 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -225,7 +225,7 @@ station_summary <- station_table(new_matches, "tag")
reactable(station_summary)
```
-```{r, fig.cap="Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where color reflects the number of detections and size reflects the number of fish at that location."}
+```{r, fig.cap="Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where colors reflect the number of detections and sizes reflect the number of fish at that location."}
# Make another label for individual
# I find mapview has limitations in legend and it cannot show the size values. Here I use leaflet
#| label: new-detection-map-leaflet
@@ -234,7 +234,7 @@ reactable(station_summary)
df <- station_spatial %>% tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.*)\\)', convert = TRUE)
df %>% as.data.frame()
-#summary(df )
+ summary(df )
numPal <- colorNumeric('viridis', df $Detections)
leaflet(data = df) %>%
From ba1e82f9ce2df51036b67bfcf3496bb415d79477 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 14:18:43 -0300
Subject: [PATCH 26/59] addMarkers
---
inst/qmd_template/make_tag_push_summary.qmd | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 4d95812..c595539 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -265,7 +265,13 @@ leaflet(data = df) %>%
values = df $Detections,
fillOpacity = .5,
decreasing = TRUE,
- position = 'bottomright')
+ position = 'bottomright')%>%
+ addMarkers(data = df, lng = ~lon, lat = ~lat,
+ popup = paste("Station ", df$station , "
",
+ "PI:", df$PI, "
",
+ "PI:", df$PI, "
",
+ "detectedby:", df$detectedby, "
",
+ "Individuals:", df$Individuals))
From 54d7b438d6bb525d052d68b0dfe1ed7913e0e62f Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 14:38:16 -0300
Subject: [PATCH 27/59] addPopups
---
inst/qmd_template/make_tag_push_summary.qmd | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index c595539..d101ef9 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -266,10 +266,10 @@ leaflet(data = df) %>%
fillOpacity = .5,
decreasing = TRUE,
position = 'bottomright')%>%
- addMarkers(data = df, lng = ~lon, lat = ~lat,
+ addPopups(data = df, lng = ~lon, lat = ~lat,
popup = paste("Station ", df$station , "
",
"PI:", df$PI, "
",
- "PI:", df$PI, "
",
+ "Detections:", df$Detections, "
",
"detectedby:", df$detectedby, "
",
"Individuals:", df$Individuals))
From abb714424026e18daeaa906a11ed002b0ca8cfc4 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 14:59:48 -0300
Subject: [PATCH 28/59] popupOptions = popupOptions(autoClose = FALSE,
closeOnClick = FALSE)
---
inst/qmd_template/make_tag_push_summary.qmd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index d101ef9..352e130 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -271,7 +271,7 @@ leaflet(data = df) %>%
"PI:", df$PI, "
",
"Detections:", df$Detections, "
",
"detectedby:", df$detectedby, "
",
- "Individuals:", df$Individuals))
+ "Individuals:", df$Individuals), popupOptions = popupOptions(autoClose = FALSE, closeOnClick = FALSE))
From 7b9a8e955c9ee362b3153057e0e526821c7eb71e Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 15:33:48 -0300
Subject: [PATCH 29/59] f
---
inst/qmd_template/make_tag_push_summary.qmd | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 352e130..44e1206 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -32,6 +32,7 @@ library(leaflet)
library(leaflegend)
library(tidyr)
library(tidyverse)
+library(leafpop)
```
@@ -271,7 +272,7 @@ leaflet(data = df) %>%
"PI:", df$PI, "
",
"Detections:", df$Detections, "
",
"detectedby:", df$detectedby, "
",
- "Individuals:", df$Individuals), popupOptions = popupOptions(autoClose = FALSE, closeOnClick = FALSE))
+ "Individuals:", df$Individuals), options = popupOptions(autoClose = FALSE, closeOnClick = FALSE))
From 9b73e5e4414bc50dfb859038839b302834380f29 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 16:10:34 -0300
Subject: [PATCH 30/59] pop
---
inst/qmd_template/make_tag_push_summary.qmd | 24 ++++++++-------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 44e1206..605d1d1 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -240,14 +240,14 @@ df %>% as.data.frame()
numPal <- colorNumeric('viridis', df $Detections)
leaflet(data = df) %>%
addTiles() %>%
- addSymbolsSize(values = ~Individuals,
- lat = ~ lat,
- lng = ~lon,
- shape = 'circle',
- color = 'black',
- fillColor = ~numPal(Detections),
- opacity = .5,
- baseSize = 1.5) %>%
+ addCircleMarkers( lat = ~lat, lng = ~lon,
+ color = ~numPal(Detections), popup = paste("Station ", df$station , "
",
+ "PI:", df$PI, "
",
+ "Detections:", df$Detections, "
",
+ "detectedby:", df$detectedby, "
",
+ "Individuals:", df$Individuals),
+ radius = ~Individuals) %>%
+
addLegendSize(
values = df $Individuals,
baseSize = 1,
@@ -266,13 +266,7 @@ leaflet(data = df) %>%
values = df $Detections,
fillOpacity = .5,
decreasing = TRUE,
- position = 'bottomright')%>%
- addPopups(data = df, lng = ~lon, lat = ~lat,
- popup = paste("Station ", df$station , "
",
- "PI:", df$PI, "
",
- "Detections:", df$Detections, "
",
- "detectedby:", df$detectedby, "
",
- "Individuals:", df$Individuals), options = popupOptions(autoClose = FALSE, closeOnClick = FALSE))
+ position = 'bottomright')
From b16958e9b0dc90567a7d04c98d3e4cd58f9b84bd Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 16:15:05 -0300
Subject: [PATCH 31/59] sd
---
inst/qmd_template/make_tag_push_summary.qmd | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 605d1d1..a38d2ae 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -240,8 +240,8 @@ df %>% as.data.frame()
numPal <- colorNumeric('viridis', df $Detections)
leaflet(data = df) %>%
addTiles() %>%
- addCircleMarkers( lat = ~lat, lng = ~lon,
- color = ~numPal(Detections), popup = paste("Station ", df$station , "
",
+ addCircleMarkers( lat = ~lat, lng = ~lon, Color= "black",
+ fillColor = ~numPal(Detections), popup = paste("Station ", df$station , "
",
"PI:", df$PI, "
",
"Detections:", df$Detections, "
",
"detectedby:", df$detectedby, "
",
From 83411ffd9550f0002089b384204fdae4d2d07505 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 16:17:52 -0300
Subject: [PATCH 32/59] c
---
inst/qmd_template/make_tag_push_summary.qmd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index a38d2ae..0cc71e4 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -240,7 +240,7 @@ df %>% as.data.frame()
numPal <- colorNumeric('viridis', df $Detections)
leaflet(data = df) %>%
addTiles() %>%
- addCircleMarkers( lat = ~lat, lng = ~lon, Color= "black",
+ addCircleMarkers( lat = ~lat, lng = ~lon, color= "black",
fillColor = ~numPal(Detections), popup = paste("Station ", df$station , "
",
"PI:", df$PI, "
",
"Detections:", df$Detections, "
",
From a7dda78fba23155a81a4e3936e0ab2dd8f3c7c44 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 16:30:46 -0300
Subject: [PATCH 33/59] fillOpacity
---
inst/qmd_template/make_tag_push_summary.qmd | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 0cc71e4..5ffb94b 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -240,8 +240,8 @@ df %>% as.data.frame()
numPal <- colorNumeric('viridis', df $Detections)
leaflet(data = df) %>%
addTiles() %>%
- addCircleMarkers( lat = ~lat, lng = ~lon, color= "black",
- fillColor = ~numPal(Detections), popup = paste("Station ", df$station , "
",
+ addCircleMarkers( lat = ~lat, lng = ~lon,
+ fillColor = ~numPal(Detections),fillOpacity = 0.7, popup = paste("Station ", df$station , "
",
"PI:", df$PI, "
",
"Detections:", df$Detections, "
",
"detectedby:", df$detectedby, "
",
From 8a48de8e6978f4f51c3b76e29ffc062eaaf79b42 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Wed, 26 Jun 2024 16:34:11 -0300
Subject: [PATCH 34/59] color~numPal(Detections)
---
inst/qmd_template/make_tag_push_summary.qmd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 5ffb94b..b95d1b6 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -241,7 +241,7 @@ numPal <- colorNumeric('viridis', df $Detections)
leaflet(data = df) %>%
addTiles() %>%
addCircleMarkers( lat = ~lat, lng = ~lon,
- fillColor = ~numPal(Detections),fillOpacity = 0.7, popup = paste("Station ", df$station , "
",
+ color= ~numPal(Detections), fillColor = ~numPal(Detections),fillOpacity = 0.7, popup = paste("Station ", df$station , "
",
"PI:", df$PI, "
",
"Detections:", df$Detections, "
",
"detectedby:", df$detectedby, "
",
From c3bb92157f96bdc71ec8540a5d801c6914ed2f20 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Thu, 27 Jun 2024 13:51:21 -0300
Subject: [PATCH 35/59] test 1
---
R/leaflet_graph.R | 47 +++++++++++++++++++++
inst/qmd_template/make_tag_push_summary.qmd | 3 +-
2 files changed, 48 insertions(+), 2 deletions(-)
create mode 100644 R/leaflet_graph.R
diff --git a/R/leaflet_graph.R b/R/leaflet_graph.R
new file mode 100644
index 0000000..4d5bc0d
--- /dev/null
+++ b/R/leaflet_graph.R
@@ -0,0 +1,47 @@
+#' @param extract OTN station_spatial
+#' @export
+#'
+library(leaflet)
+library(leaflegend)
+library(tidyr)
+library(tidyverse)
+
+
+leaflet_graph <- function(station_spatial) {
+ df <- station_spatial %>% tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.*)\\)', convert = TRUE)
+ df %>% as.data.frame()
+ numPal <- colorNumeric('viridis', df $Detections)
+ leaflet::leaflet(data = df) %>%
+ addTiles() %>%
+ addCircleMarkers( lat = ~lat, lng = ~lon,
+ color= ~numPal(Detections), 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,
+ baseSize = 1,
+ color = 'black',
+ title = 'Individual',
+ shape = 'circle',
+ orientation = 'horizontal',
+ opacity = .5,
+ fillOpacity = 0,
+ breaks = 5,
+ position = 'bottomright') %>%
+ leaflegend::addLegendNumeric(
+ pal = numPal,
+ title = 'Matched Detection',
+ shape = 'stadium',
+ values = df $Detections,
+ fillOpacity = .5,
+ decreasing = TRUE,
+ position = 'bottomright')
+
+
+
+}
+
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 1384c2a..43a237b 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -31,8 +31,7 @@ library(reactable)
library(leaflet)
library(leaflegend)
library(tidyr)
-library(tidyverse)
-library(leafpop)
+
```
From d71e9f3a356c772fb52dbeb5d017811ec3e45ee4 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Thu, 27 Jun 2024 15:44:59 -0300
Subject: [PATCH 36/59] test 2
---
R/leaflet_graph.R | 5 +--
inst/qmd_template/make_tag_push_summary.qmd | 36 +--------------------
2 files changed, 2 insertions(+), 39 deletions(-)
diff --git a/R/leaflet_graph.R b/R/leaflet_graph.R
index 4d5bc0d..db121fe 100644
--- a/R/leaflet_graph.R
+++ b/R/leaflet_graph.R
@@ -1,10 +1,7 @@
#' @param extract OTN station_spatial
#' @export
#'
-library(leaflet)
-library(leaflegend)
-library(tidyr)
-library(tidyverse)
+
leaflet_graph <- function(station_spatial) {
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 43a237b..f6273d7 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -235,42 +235,8 @@ reactable(new_station_summary)
#| fig-cap: Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where color reflects the number of detections and size reflects the number of fish at that location.
-df <- station_spatial %>% tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.*)\\)', convert = TRUE)
-df %>% as.data.frame()
-
- summary(df )
-
-numPal <- colorNumeric('viridis', df $Detections)
-leaflet(data = df) %>%
- addTiles() %>%
- addCircleMarkers( lat = ~lat, lng = ~lon,
- color= ~numPal(Detections), 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) %>%
-
- addLegendSize(
- values = df $Individuals,
- baseSize = 1,
- color = 'black',
- title = 'Individual',
- shape = 'circle',
- orientation = 'horizontal',
- opacity = .5,
- fillOpacity = 0,
- breaks = 5,
- position = 'bottomright') %>%
- addLegendNumeric(
- pal = numPal,
- title = 'Matched Detection',
- shape = 'stadium',
- values = df $Detections,
- fillOpacity = .5,
- decreasing = TRUE,
- position = 'bottomright')
+leaflet_graph(station_spatial)
From 69fd0768bdaa165decf47ef273419e4f924f8302 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Thu, 27 Jun 2024 15:45:32 -0300
Subject: [PATCH 37/59] test 1
---
inst/qmd_template/make_tag_push_summary.qmd | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index f6273d7..4bd0630 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -28,9 +28,7 @@ library(otndo)
library(data.table)
library(mapview)
library(reactable)
-library(leaflet)
-library(leaflegend)
-library(tidyr)
+
```
From 325a906d1875ddda5ee037feb0a97f021ba416a5 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Thu, 27 Jun 2024 16:14:18 -0300
Subject: [PATCH 38/59] install packages
---
DESCRIPTION | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index 9faa893..f6f897c 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -24,7 +24,11 @@ Imports:
quarto,
readxl,
rmarkdown,
- utils
+ utils,
+ leaflet,
+ leaflegend,
+ tidyr
+
Suggests:
curl,
knitr,
From d1148f46153586ba10e1ce71d034e20242ae271e Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Thu, 27 Jun 2024 16:38:30 -0300
Subject: [PATCH 39/59] remove empty
---
DESCRIPTION | 1 -
R/leaflet_graph.R | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index f6f897c..87fd428 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -28,7 +28,6 @@ Imports:
leaflet,
leaflegend,
tidyr
-
Suggests:
curl,
knitr,
diff --git a/R/leaflet_graph.R b/R/leaflet_graph.R
index db121fe..f675923 100644
--- a/R/leaflet_graph.R
+++ b/R/leaflet_graph.R
@@ -1,5 +1,5 @@
#' @param extract OTN station_spatial
-#' @export
+#' @export
#'
From 9b5f99a1873313c0e3fd6e847a227cedf896c8e1 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Thu, 27 Jun 2024 16:45:12 -0300
Subject: [PATCH 40/59] titlw and param
---
NAMESPACE | 1 +
R/leaflet_graph.R | 8 +++-----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/NAMESPACE b/NAMESPACE
index 8306c79..80f9594 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -1,6 +1,7 @@
# Generated by roxygen2: do not edit by hand
export(deployment_gantt)
+export(leaflet_graph)
export(make_receiver_push_summary)
export(make_tag_push_summary)
export(match_map)
diff --git a/R/leaflet_graph.R b/R/leaflet_graph.R
index f675923..74ad4d4 100644
--- a/R/leaflet_graph.R
+++ b/R/leaflet_graph.R
@@ -1,8 +1,6 @@
-#' @param extract OTN station_spatial
-#' @export
-#'
-
-
+#' Plot the leaflet graphs for detection and individual
+#' @param station_spatial
+#' @export
leaflet_graph <- function(station_spatial) {
df <- station_spatial %>% tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.*)\\)', convert = TRUE)
From 2eb0f47bafa3917195ef3acc51d397e5923472a5 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Thu, 27 Jun 2024 16:46:11 -0300
Subject: [PATCH 41/59] leaflet function
---
man/leaflet_graph.Rd | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 man/leaflet_graph.Rd
diff --git a/man/leaflet_graph.Rd b/man/leaflet_graph.Rd
new file mode 100644
index 0000000..e89a481
--- /dev/null
+++ b/man/leaflet_graph.Rd
@@ -0,0 +1,14 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/leaflet_graph.R
+\name{leaflet_graph}
+\alias{leaflet_graph}
+\title{Plot the leaflet graphs for detection and individual}
+\usage{
+leaflet_graph(station_spatial)
+}
+\arguments{
+\item{station_spatial}{}
+}
+\description{
+Plot the leaflet graphs for detection and individual
+}
From 293903bd1980919c3d8e1270652ee4537ed066b2 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Thu, 27 Jun 2024 16:53:19 -0300
Subject: [PATCH 42/59] pipe
---
R/leaflet_graph.R | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/R/leaflet_graph.R b/R/leaflet_graph.R
index 74ad4d4..7914389 100644
--- a/R/leaflet_graph.R
+++ b/R/leaflet_graph.R
@@ -3,18 +3,18 @@
#' @export
leaflet_graph <- function(station_spatial) {
- df <- station_spatial %>% tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.*)\\)', convert = TRUE)
- df %>% as.data.frame()
+ df <- station_spatial |> tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.*)\\)', convert = TRUE)
+ df |> as.data.frame()
numPal <- colorNumeric('viridis', df $Detections)
- leaflet::leaflet(data = df) %>%
- addTiles() %>%
+ leaflet::leaflet(data = df) |>
+ addTiles() |>
addCircleMarkers( lat = ~lat, lng = ~lon,
color= ~numPal(Detections), 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) %>%
+ radius = ~Individuals) |>
leaflegend::addLegendSize(
values = df $Individuals,
@@ -26,7 +26,7 @@ leaflet_graph <- function(station_spatial) {
opacity = .5,
fillOpacity = 0,
breaks = 5,
- position = 'bottomright') %>%
+ position = 'bottomright') |>
leaflegend::addLegendNumeric(
pal = numPal,
title = 'Matched Detection',
From d419897f0f393a2917fe4500bc2736fdb7cb628e Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Tue, 2 Jul 2024 09:24:02 -0300
Subject: [PATCH 43/59] test 3
---
R/leaflet_graph.R | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/R/leaflet_graph.R b/R/leaflet_graph.R
index 7914389..95d956e 100644
--- a/R/leaflet_graph.R
+++ b/R/leaflet_graph.R
@@ -5,7 +5,7 @@
leaflet_graph <- function(station_spatial) {
df <- station_spatial |> tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.*)\\)', convert = TRUE)
df |> as.data.frame()
- numPal <- colorNumeric('viridis', df $Detections)
+ numPal <- leaflet::colorNumeric('viridis', df $Detections)
leaflet::leaflet(data = df) |>
addTiles() |>
addCircleMarkers( lat = ~lat, lng = ~lon,
From 509d2953b99458df04e2b07edf0c99978acebd50 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Tue, 2 Jul 2024 09:28:15 -0300
Subject: [PATCH 44/59] test 4
---
R/leaflet_graph.R | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/R/leaflet_graph.R b/R/leaflet_graph.R
index 95d956e..873814b 100644
--- a/R/leaflet_graph.R
+++ b/R/leaflet_graph.R
@@ -7,8 +7,8 @@ leaflet_graph <- function(station_spatial) {
df |> as.data.frame()
numPal <- leaflet::colorNumeric('viridis', df $Detections)
leaflet::leaflet(data = df) |>
- addTiles() |>
- addCircleMarkers( lat = ~lat, lng = ~lon,
+ leaflet::addTiles() |>
+ leaflet::addCircleMarkers( lat = ~lat, lng = ~lon,
color= ~numPal(Detections), fillColor = ~numPal(Detections),fillOpacity = 0.7, popup = paste("Station ", df$station , "
",
"PI:", df$PI, "
",
"Detections:", df$Detections, "
",
From 1fb1ed184d81bb9e93f58972e4d41223afce50d4 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Tue, 2 Jul 2024 10:10:02 -0300
Subject: [PATCH 45/59] geometry<- NULL
---
R/leaflet_graph.R | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/R/leaflet_graph.R b/R/leaflet_graph.R
index 873814b..c4c4746 100644
--- a/R/leaflet_graph.R
+++ b/R/leaflet_graph.R
@@ -1,8 +1,9 @@
#' Plot the leaflet graphs for detection and individual
-#' @param station_spatial
+#' @param station_spatial Default is NULL
#' @export
leaflet_graph <- function(station_spatial) {
+ geometry<- NULL
df <- station_spatial |> tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.*)\\)', convert = TRUE)
df |> as.data.frame()
numPal <- leaflet::colorNumeric('viridis', df $Detections)
From 979f7d3f2d1b0e35e36ec95fc48d3660eb3d2ceb Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Tue, 2 Jul 2024 10:22:25 -0300
Subject: [PATCH 46/59] update doucument
---
man/leaflet_graph.Rd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man/leaflet_graph.Rd b/man/leaflet_graph.Rd
index e89a481..de6b877 100644
--- a/man/leaflet_graph.Rd
+++ b/man/leaflet_graph.Rd
@@ -7,7 +7,7 @@
leaflet_graph(station_spatial)
}
\arguments{
-\item{station_spatial}{}
+\item{station_spatial}{Default is NULL}
}
\description{
Plot the leaflet graphs for detection and individual
From 4bb126f5c60b6b67ed1565dae6ef17bf9662f693 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Tue, 2 Jul 2024 10:30:40 -0300
Subject: [PATCH 47/59] add description to the param
---
R/leaflet_graph.R | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/R/leaflet_graph.R b/R/leaflet_graph.R
index c4c4746..e487803 100644
--- a/R/leaflet_graph.R
+++ b/R/leaflet_graph.R
@@ -1,5 +1,5 @@
#' Plot the leaflet graphs for detection and individual
-#' @param station_spatial Default is NULL
+#' @param station_spatial is created by prep_station_spatial,which is a spatial object with the geometry
#' @export
leaflet_graph <- function(station_spatial) {
From 03e2b0bbe62e85fa607c8b4b5414594b93543f74 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Tue, 2 Jul 2024 10:31:03 -0300
Subject: [PATCH 48/59] update
---
man/leaflet_graph.Rd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man/leaflet_graph.Rd b/man/leaflet_graph.Rd
index de6b877..d679ce7 100644
--- a/man/leaflet_graph.Rd
+++ b/man/leaflet_graph.Rd
@@ -7,7 +7,7 @@
leaflet_graph(station_spatial)
}
\arguments{
-\item{station_spatial}{Default is NULL}
+\item{station_spatial}{is created by prep_station_spatial,which is a spatial object with the geometry}
}
\description{
Plot the leaflet graphs for detection and individual
From 34c2a97c47ce83e1cf0e2b75ed4f8d0cccdc8d9a Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Tue, 2 Jul 2024 11:08:13 -0300
Subject: [PATCH 49/59] test 6
---
inst/qmd_template/make_tag_push_summary.qmd | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 4bd0630..45acee0 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -28,8 +28,6 @@ library(otndo)
library(data.table)
library(mapview)
library(reactable)
-
-
```
@@ -226,18 +224,13 @@ new_station_summary <- station_table(new_matches, "tag")
reactable(new_station_summary)
```
-```{r, fig.cap="Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where colors reflect the number of detections and sizes reflect the number of fish at that location."}
-# Make another label for individual
-# I find mapview has limitations in legend and it cannot show the size values. Here I use leaflet
+```{r}
#| label: new-detection-map-leaflet
-
#| fig-cap: Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where color reflects the number of detections and size reflects the number of fish at that location.
+ #| eval: !expr "nrow(new_matches) > 0"
leaflet_graph(station_spatial)
-
-
-
```
From a902162750b8d47458132e0f3beff92f13f493fd Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Tue, 2 Jul 2024 11:08:33 -0300
Subject: [PATCH 50/59] test6
---
inst/qmd_template/make_tag_push_summary.qmd | 2 --
1 file changed, 2 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 45acee0..bbcdc69 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -25,8 +25,6 @@ knitr::opts_chunk$set(
#| message: false
library(otndo)
-library(data.table)
-library(mapview)
library(reactable)
```
From c8d0f9824800a9f6767774caf3443bcff4255782 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Tue, 2 Jul 2024 11:10:47 -0300
Subject: [PATCH 51/59] test 6
---
DESCRIPTION | 1 -
1 file changed, 1 deletion(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index 87fd428..370e73e 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -24,7 +24,6 @@ Imports:
quarto,
readxl,
rmarkdown,
- utils,
leaflet,
leaflegend,
tidyr
From 027354556f26fb799897dcc6f7b9da6a36ec6aea Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Tue, 2 Jul 2024 11:16:35 -0300
Subject: [PATCH 52/59] utils
---
DESCRIPTION | 1 +
1 file changed, 1 insertion(+)
diff --git a/DESCRIPTION b/DESCRIPTION
index 370e73e..87fd428 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -24,6 +24,7 @@ Imports:
quarto,
readxl,
rmarkdown,
+ utils,
leaflet,
leaflegend,
tidyr
From 342dd0cec1c38b3a699a58dfee28a903b19c9df5 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Tue, 2 Jul 2024 11:46:11 -0300
Subject: [PATCH 53/59] library change
---
inst/qmd_template/make_tag_push_summary.qmd | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index bbcdc69..2def391 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -23,9 +23,8 @@ knitr::opts_chunk$set(
```{r}
#| label: packages
#| message: false
-
+library(data.table)
library(otndo)
-library(reactable)
```
From fe55d462971ca9dd61b8aae326196af8177cda3e Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Tue, 2 Jul 2024 11:50:54 -0300
Subject: [PATCH 54/59] need library(reactable)
---
inst/qmd_template/make_tag_push_summary.qmd | 1 +
1 file changed, 1 insertion(+)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 2def391..1f9b843 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -25,6 +25,7 @@ knitr::opts_chunk$set(
#| message: false
library(data.table)
library(otndo)
+library(reactable)
```
From cb1b778ff3ff0f996a593815139d42be9b950c75 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Tue, 2 Jul 2024 12:20:00 -0300
Subject: [PATCH 55/59] space remove
---
inst/qmd_template/make_tag_push_summary.qmd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index 1f9b843..e3597fb 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -225,7 +225,7 @@ reactable(new_station_summary)
```{r}
#| label: new-detection-map-leaflet
#| fig-cap: Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where color reflects the number of detections and size reflects the number of fish at that location.
- #| eval: !expr "nrow(new_matches) > 0"
+#| eval: !expr "nrow(new_matches) > 0"
leaflet_graph(station_spatial)
From 191335e67276e4a940d9c4e0ab889725785a42c9 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Tue, 2 Jul 2024 12:22:49 -0300
Subject: [PATCH 56/59] remove df |> as.data.frame()
---
R/leaflet_graph.R | 1 -
1 file changed, 1 deletion(-)
diff --git a/R/leaflet_graph.R b/R/leaflet_graph.R
index e487803..edc69eb 100644
--- a/R/leaflet_graph.R
+++ b/R/leaflet_graph.R
@@ -5,7 +5,6 @@
leaflet_graph <- function(station_spatial) {
geometry<- NULL
df <- station_spatial |> tidyr::extract(geometry, c('lon', 'lat'), '\\((.*), (.*)\\)', convert = TRUE)
- df |> as.data.frame()
numPal <- leaflet::colorNumeric('viridis', df $Detections)
leaflet::leaflet(data = df) |>
leaflet::addTiles() |>
From 6ab36ce925848d077e557245fef28eb7ea89756c Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Tue, 2 Jul 2024 12:26:56 -0300
Subject: [PATCH 57/59] formatting
---
R/leaflet_graph.R | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/R/leaflet_graph.R b/R/leaflet_graph.R
index edc69eb..76cc9a8 100644
--- a/R/leaflet_graph.R
+++ b/R/leaflet_graph.R
@@ -9,11 +9,12 @@ leaflet_graph <- function(station_spatial) {
leaflet::leaflet(data = df) |>
leaflet::addTiles() |>
leaflet::addCircleMarkers( lat = ~lat, lng = ~lon,
- color= ~numPal(Detections), fillColor = ~numPal(Detections),fillOpacity = 0.7, popup = paste("Station ", df$station , "
",
- "PI:", df$PI, "
",
- "Detections:", df$Detections, "
",
- "detectedby:", df$detectedby, "
",
- "Individuals:", df$Individuals),
+ color= ~numPal(Detections), 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(
From 690c62928ca83899a08b864a0b54f8f376cff302 Mon Sep 17 00:00:00 2001
From: JOY LIU <113057199+joyliujoyliu@users.noreply.github.com>
Date: Tue, 2 Jul 2024 12:28:34 -0300
Subject: [PATCH 58/59] space
---
inst/qmd_template/make_tag_push_summary.qmd | 1 -
1 file changed, 1 deletion(-)
diff --git a/inst/qmd_template/make_tag_push_summary.qmd b/inst/qmd_template/make_tag_push_summary.qmd
index e3597fb..7857ae8 100644
--- a/inst/qmd_template/make_tag_push_summary.qmd
+++ b/inst/qmd_template/make_tag_push_summary.qmd
@@ -227,7 +227,6 @@ reactable(new_station_summary)
#| fig-cap: Figure 7. Number of newly-added detections per receiver. Points represent receiver locations, where color reflects the number of detections and size reflects the number of fish at that location.
#| eval: !expr "nrow(new_matches) > 0"
-
leaflet_graph(station_spatial)
```
From f3c0c02958e372e7c4234961831c8da11eb7cb1b Mon Sep 17 00:00:00 2001
From: joyliujoyliu
Date: Tue, 2 Jul 2024 15:40:42 +0000
Subject: [PATCH 59/59] Style code (GHA)
---
R/leaflet_graph.R | 53 ++++++++++++++++++++++++-----------------------
1 file changed, 27 insertions(+), 26 deletions(-)
diff --git a/R/leaflet_graph.R b/R/leaflet_graph.R
index 76cc9a8..0b8a73d 100644
--- a/R/leaflet_graph.R
+++ b/R/leaflet_graph.R
@@ -3,41 +3,42 @@
#' @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= ~numPal(Detections), 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) |>
-
+ leaflet::addCircleMarkers(
+ lat = ~lat, lng = ~lon,
+ color = ~ numPal(Detections), 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 = 1,
- color = 'black',
- title = 'Individual',
- shape = 'circle',
- orientation = 'horizontal',
+ color = "black",
+ title = "Individual",
+ shape = "circle",
+ orientation = "horizontal",
opacity = .5,
fillOpacity = 0,
breaks = 5,
- position = 'bottomright') |>
+ position = "bottomright"
+ ) |>
leaflegend::addLegendNumeric(
pal = numPal,
- title = 'Matched Detection',
- shape = 'stadium',
- values = df $Detections,
+ title = "Matched Detection",
+ shape = "stadium",
+ values = df$Detections,
fillOpacity = .5,
decreasing = TRUE,
- position = 'bottomright')
-
-
-
+ position = "bottomright"
+ )
}
-