@@ -3758,7 +3758,7 @@ metric.values.fish <- function(myDF
37583758 , " BCG_ATTR2" )
37593759 col.req_logical <- c(" EXCLUDE" , " HYBRID" )
37603760 col.req_numeric <- c(" N_TAXA" , " N_ANOMALIES" , " SAMP_BIOMASS" , " DA_MI2"
3761- , " SAMP_WIDTH_M" , " SAMP_LENGTH_M" , " TOLVAL2"
3761+ , " SAMP_WIDTH_M" , " SAMP_LENGTH_M" , " TOLVAL2" , " AGECLASS "
37623762 )
37633763 col.req <- c(col.req_character , col.req_logical , col.req_numeric )
37643764 # col.req <- c("SAMPLEID", "TAXAID", "N_TAXA", "EXCLUDE"
@@ -4481,6 +4481,7 @@ metric.values.fish <- function(myDF
44814481 , nt_natCent = dplyr :: n_distinct(TAXAID [EXCLUDE != TRUE & NATIVE == " NATIVE" & FAMILY == " CENTRARCHIDAE" ], na.rm = TRUE )
44824482 , nt_natinsctCypr = dplyr :: n_distinct(TAXAID [EXCLUDE != TRUE & NATIVE == " NATIVE" &
44834483 TROPHIC_IS == TRUE & FAMILY == " CYPRINIDAE" ], na.rm = TRUE )
4484+ , nt_natLeuc = dplyr :: n_distinct(TAXAID [EXCLUDE != TRUE & NATIVE == " NATIVE" & FAMILY == " LEUCISCIDAE" ], na.rm = TRUE )
44844485 , nt_natrbs = dplyr :: n_distinct(TAXAID [EXCLUDE != TRUE & NATIVE == " NATIVE" & TYPE == " RBS" ], na.rm = TRUE )
44854486 , nt_Petro = dplyr :: n_distinct(TAXAID [EXCLUDE != TRUE & FAMILY == " PETROMYZONTIDAE" ], na.rm = TRUE )
44864487 , nt_Salm = dplyr :: n_distinct(TAXAID [EXCLUDE != TRUE & FAMILY == " SALMONIDAE" ], na.rm = TRUE )
@@ -4539,6 +4540,10 @@ metric.values.fish <- function(myDF
45394540 , nt_invertivore = dplyr :: n_distinct(TAXAID [EXCLUDE != TRUE
45404541 & TROPHIC_IV == TRUE ]
45414542 , na.rm = TRUE )
4543+ , nt_invert_native = dplyr :: n_distinct(TAXAID [EXCLUDE != TRUE
4544+ & TROPHIC_IV == TRUE
4545+ & NATIVE == " NATIVE" ]
4546+ , na.rm = TRUE )
45424547 , nt_inverttopcarn = dplyr :: n_distinct(TAXAID [EXCLUDE != TRUE
45434548 & TROPHIC_IV_TC == TRUE ]
45444549 , na.rm = TRUE )
@@ -4570,6 +4575,7 @@ metric.values.fish <- function(myDF
45704575 , pi_insctCypr = 100 * sum(N_TAXA [TROPHIC_IS == TRUE &
45714576 FAMILY == " CYPRINIDAE" ], na.rm = TRUE ) / ni_total
45724577 , pi_invertivore = 100 * sum(N_TAXA [TROPHIC_IV == TRUE ], na.rm = TRUE ) / ni_total
4578+ , pi_invert_native = 100 * sum(N_TAXA [TROPHIC_IV == TRUE & NATIVE == " NATIVE" ], na.rm = TRUE ) / ni_total
45734579 , pi_inverttopcarn = 100 * sum(N_TAXA [TROPHIC_IV_TC == TRUE ], na.rm = TRUE ) / ni_total
45744580 , pi_omnivore = 100 * sum(N_TAXA [TROPHIC_OM == TRUE ], na.rm = TRUE ) / ni_total
45754581 , pi_planktivore = 100 * sum(N_TAXA [TROPHIC_PL == TRUE ], na.rm = TRUE ) / ni_total
@@ -4584,17 +4590,24 @@ metric.values.fish <- function(myDF
45844590 , pt_detritivore = 100 * nt_detritivore / nt_total
45854591 , pt_herbivore = 100 * nt_herbivore / nt_total
45864592 , pt_invertivore = 100 * nt_invertivore / nt_total
4593+ , pt_invert_native = 100 * nt_invert_native / nt_total
45874594 , pt_inverttopcarn = 100 * nt_inverttopcarn / nt_total
45884595 , pt_omnivore = 100 * nt_omnivore / nt_total
45894596 , pt_planktivore = 100 * nt_planktivore / nt_total
45904597 , pt_topcarn = 100 * nt_topcarn / nt_total
45914598
45924599 #
45934600 # # Tolerance ####
4594- , nt_tv_intol = dplyr :: n_distinct(TAXAID [EXCLUDE != TRUE & TOLER == " INTOLERANT" ], na.rm = TRUE )
4595- , nt_tv_intolhwi = dplyr :: n_distinct(TAXAID [EXCLUDE != TRUE & (TOLER == " INTOLERANT" |
4596- TOLER == " HWI" )], na.rm = TRUE )
4597- , pi_tv_toler = 100 * sum(N_TAXA [TOLER == " TOLERANT" ], na.rm = TRUE ) / ni_total
4601+ , nt_tv_intol = dplyr :: n_distinct(
4602+ TAXAID [EXCLUDE != TRUE & TOLER == " INTOLERANT" ],
4603+ na.rm = TRUE )
4604+ , nt_tv_intolhwi = dplyr :: n_distinct(
4605+ TAXAID [EXCLUDE != TRUE &
4606+ (TOLER == " INTOLERANT" | TOLER == " HWI" )],
4607+ na.rm = TRUE )
4608+ , pi_tv_toler = 100 *
4609+ sum(N_TAXA [TOLER == " TOLERANT" ], na.rm = TRUE ) /
4610+ ni_total
45984611 #
45994612
46004613
@@ -5069,7 +5082,7 @@ metric.values.fish <- function(myDF
50695082 , na.rm = TRUE ) / ni_total
50705083 , pi_repro_migratory = 100 * sum(N_TAXA [REPRO_MIG == TRUE ]
50715084 , na.rm = TRUE ) / ni_total
5072- , pi_repro_lithophil = 100 * sum(N_TAXA [REPRO_LITH == TRUE ]
5085+ , pi_repro_lithophil = 100 * sum(N_TAXA [REPRO_LITH == TRUE ]
50735086 , na.rm = TRUE ) / ni_total
50745087
50755088 # ## Repro, pt ----
@@ -5107,6 +5120,35 @@ metric.values.fish <- function(myDF
51075120 , pt_habitat_w = 100 * nt_habitat_w / nt_total
51085121 , pt_habitat_f = 100 * nt_habitat_f / nt_total
51095122
5123+ # # Age Class ----
5124+ # Young of Year, YOY is ageclass 1 or 2
5125+ , d_ac_yoy_Cott = max(0 ,
5126+ min(1 ,
5127+ dplyr :: n_distinct(
5128+ TAXAID [(EXCLUDE != TRUE &
5129+ FAMILY == " COTTIDAE" ) &
5130+ (AGECLASS == 1 |
5131+ AGECLASS == 2 )],
5132+ na.rm = TRUE ),
5133+ na.rm = TRUE ),
5134+ na.rm = TRUE )
5135+ , d_ac_yoy_rbt = max(0 ,
5136+ min(1 ,
5137+ dplyr :: n_distinct(
5138+ TAXAID [(EXCLUDE != TRUE &
5139+ TAXAID == " ONCORHYNCHUS MYKISS" ) &
5140+ (AGECLASS == 1 |
5141+ AGECLASS == 2 )],
5142+ na.rm = TRUE ),
5143+ na.rm = TRUE ),
5144+ na.rm = TRUE )
5145+ , n_ac_Cott = dplyr :: n_distinct(AGECLASS [EXCLUDE != TRUE &
5146+ FAMILY == " COTTIDAE" ],
5147+ na.rm = TRUE )
5148+ , n_ac_rbt = dplyr :: n_distinct(AGECLASS [EXCLUDE != TRUE &
5149+ TAXAID == " ONCORHYNCHUS MYKISS" ],
5150+ na.rm = TRUE )
5151+
51105152 # # SPECIAL ----
51115153 # odd ball metrics that don't fit the above groupings
51125154 # OR are really different and probably only applicable
0 commit comments