@@ -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