You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/create_condition_indicator.R
+67-23Lines changed: 67 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -9,22 +9,32 @@
9
9
#' @param by_EPU logical. If TRUE, calculates condition by EPUs specified in the input data, if FALSE, calculates condition for all data combined.
10
10
#' @param by_sex logical. If TRUE, calculates condition by sex. If FALSE, calculates condition across sexes.
11
11
#' @param length_break numeric vector. If not NULL, will calculate condition by length breaks specified in the vector. User must specify minimum and maximum lengths in this parameter, e.g., c(0, 20, 70). If NULL, will not calculate by length groupings.
12
+
#' @param more_than_20_years logical. If TRUE, only returns species with 20 or more years of data.
13
+
#' @param record_outliers logical. If TRUE, returns a list with two data frames: the first is the condition data frame, the second is a data frame of outliers that were removed from the analysis. If FALSE, only returns the condition data frame.
12
14
#' @param output character. If "soe", returns a data frame of species condition for the State of the Ecosystem report. If "esp", returns a data frame for ESPs. If "full", returns a data frame of all calculated values. *Setting by_sex = TRUE or length_break to any value will always return a full dataframe*
13
15
#' @importFrom magrittr %>%
14
16
#' @return Returns a data frame of species condition
15
17
#' @export
16
18
17
-
species_condition<-function(data,
18
-
LWparams=NEesp2::LWparams,
19
-
species.codes=NEesp2::species.codes,
20
-
by_EPU=TRUE,
21
-
by_sex=FALSE,
22
-
length_break=NULL,
23
-
output="soe") {
24
-
if (by_sex|
25
-
!is.null(length_break)) {
19
+
species_condition<-function(
20
+
data,
21
+
LWparams=NEesp2::LWparams,
22
+
species.codes=NEesp2::species.codes,
23
+
by_EPU=TRUE,
24
+
by_sex=FALSE,
25
+
length_break=NULL,
26
+
more_than_20_years=TRUE,
27
+
record_outliers=FALSE,
28
+
output="soe"
29
+
) {
30
+
if (
31
+
by_sex|
32
+
!is.null(length_break)
33
+
) {
26
34
if (output!="full") {
27
-
message("You asked to group results by sex and/or length ; data will not be formatted for SOE or ESP output.")
35
+
message(
36
+
"You asked to group results by sex and/or length ; data will not be formatted for SOE or ESP output."
0 commit comments