Skip to content

Commit 215639d

Browse files
authored
Merge pull request #21 from OB7-IRD/correct_legend_fishing_activity_figure
Correct legend fishing activity figure
2 parents a3b6f64 + 6db1f8b commit 215639d

File tree

3 files changed

+31
-22
lines changed

3 files changed

+31
-22
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: fishi
22
Type: Package
33
Title: Package Fisheries Indicators
4-
Version: 0.9.2
4+
Version: 0.9.3
55
Authors@R:
66
c(person(given = "Clara",
77
family = "Lerebourg",

NEWS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# fishi 0.9.3 -2025-10-21
2+
3+
## Changed
4+
5+
Correct inversion between FOB-associated schools and free swimming schools in the legend of the figure generated by the function [`fishing_activity()`](https://ob7-ird.github.io/fishi/reference/fishing_activity.html)
6+
7+
## Added
8+
9+
Add changelog

R/fishing_activity.R

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ fishing_activity <- function(dataframe,
3131
total_set <- NULL
3232
positive_set <- NULL
3333
school_type <- NULL
34-
l_total <- NULL
35-
a_total <- NULL
36-
f_total <- NULL
34+
FOB_total <- NULL
35+
all_total <- NULL
36+
FSC_total <- NULL
3737
nb_sets <- NULL
3838
type <- NULL
3939
`%_log` <- NULL
4040
time_period <- NULL
4141
year <- NULL
42-
l_null <- NULL
43-
a_null <- NULL
44-
f_null <- NULL
42+
FOB_null <- NULL
43+
all_null <- NULL
44+
FSC_null <- NULL
4545
# 1 - Arguments verification ----
4646
if (codama::r_type_checking(r_object = graph_type,
4747
type = "character",
@@ -64,33 +64,33 @@ fishing_activity <- function(dataframe,
6464
# db a1 - Add : Number of total, positive, and null sets by ALL
6565
a1 <- fishing_activity_t1 %>%
6666
dplyr::group_by(year) %>%
67-
dplyr::summarise(a_total = sum(total_set,
67+
dplyr::summarise(all_total = sum(total_set,
6868
na.rm = TRUE),
69-
a_positive = sum(positive_set,
69+
all_positive = sum(positive_set,
7070
na.rm = TRUE),
71-
a_null = sum(total_set - positive_set,
71+
all_null = sum(total_set - positive_set,
7272
na.rm = TRUE),
7373
.groups = "drop")
7474
# db a2 - Add : Number of total, positive, and null sets by FOB
7575
a2 <- fishing_activity_t1 %>%
7676
dplyr::filter(school_type %in% "FOB") %>%
7777
dplyr::group_by(year) %>%
78-
dplyr::summarise(l_total = sum(total_set,
78+
dplyr::summarise(FOB_total = sum(total_set,
7979
na.rm = TRUE),
80-
l_positive = sum(positive_set,
80+
FOB_positive = sum(positive_set,
8181
na.rm = TRUE),
82-
l_null = sum(total_set - positive_set,
82+
FOB_null = sum(total_set - positive_set,
8383
na.rm = TRUE),
8484
.groups = "drop")
8585
# db a3 - Add : Number of total, positive, and null sets by FSC
8686
a3 <- fishing_activity_t1 %>%
8787
dplyr::filter(school_type %in% "FSC" | school_type %in% "UND") %>%
8888
dplyr::group_by(year) %>%
89-
dplyr::summarise(f_total = sum(total_set,
89+
dplyr::summarise(FSC_total = sum(total_set,
9090
na.rm = TRUE),
91-
f_positive = sum(positive_set,
91+
FSC_positive = sum(positive_set,
9292
na.rm = TRUE),
93-
f_null = sum(total_set - positive_set,
93+
FSC_null = sum(total_set - positive_set,
9494
na.rm = TRUE),
9595
.groups = "drop")
9696
# Merge db by Year
@@ -99,12 +99,12 @@ fishing_activity <- function(dataframe,
9999
# For ggplot graph
100100
if (with_catch == "with") {
101101
table_sets <- table_sets %>%
102-
dplyr::mutate("%_log" = l_total / a_total * 100)
102+
dplyr::mutate("%_log" = FOB_total / all_total * 100)
103103
set <- as.matrix(table_sets[, c(1, 5, 8, 11)])
104104
t_set <- as.data.frame(set)
105105
t_set <- t_set %>%
106-
dplyr::rename(`Free swimming schools` = l_total,
107-
`FOB-associated schools` = f_total)
106+
dplyr::rename(`Free swimming schools` = FSC_total,
107+
`FOB-associated schools` = FOB_total)
108108
t_set_pivot <- tidyr::pivot_longer(t_set,
109109
cols = c(2:3),
110110
names_to = "type",
@@ -113,12 +113,12 @@ fishing_activity <- function(dataframe,
113113
name_set <- "Number of sets"
114114
} else if (with_catch == "without") {
115115
table_sets <- table_sets %>%
116-
dplyr::mutate("%_log" = l_null / a_null * 100)
116+
dplyr::mutate("%_log" = FOB_null / all_null * 100)
117117
set <- as.matrix(table_sets[, c(1, 7, 10, 11)])
118118
t_set <- as.data.frame(set)
119119
t_set <- t_set %>%
120-
dplyr::rename(`Free swimming schools` = l_null,
121-
`FOB-associated schools` = f_null)
120+
dplyr::rename(`Free swimming schools` = FSC_null,
121+
`FOB-associated schools` = FOB_null)
122122
t_set_pivot <- tidyr::pivot_longer(t_set,
123123
cols = c(2:3),
124124
names_to = "type",

0 commit comments

Comments
 (0)