get_covrow: Get covrow Get total number of trips (N) and observed trips...

View source: R/get_covrow.R

get_covrowR Documentation

Get covrow Get total number of trips (N) and observed trips (n) in a strata Get the row-based covariance based on Chris Legault's equations/markdown

Description

Get covrow Get total number of trips (N) and observed trips (n) in a strata Get the row-based covariance based on Chris Legault's equations/markdown

Usage

get_covrow(joined_table)

Arguments

joined_table

table produced during run_discard or from discard_diagnostic

Value

data frame of trips and discards

Author(s)

Benjamin Galuardi, Chris Legault, Daniel Hocking

Examples


# all discard_sources
R no
I yes
EM yes
N no
O no
B yes
A yes
DELTA yes
T yes
GM yes
G yes
 # example

# first, run discard_diagnostic for any species
joined_table = mydiscard$trips_discard

Ntable = get_covrow(joined_table)

# Take a look
joined_table %>%
	dplyr::select(starts_with('N_') | starts_with('n_') | DISCARD_SOURCE |  CAMS_GEAR_GROUP | SPECIES_STOCK | MESH_CAT | TRIPCATEGORY | ACCESSAREA) %>%
	distinct() %>%
	View()

# check sums
joined_table %>%
	filter(DISCARD_SOURCE == 'I') %>%
	group_by(STRATA_USED_DESC) %>%
	dplyr::summarise(trip_var_total = sum(var, na.rm = T)
									 # , strata_var = max(VAR_RATE_STRATA, na.rm = T)
									 , CV_STRATA = max(CV, na.rm = T)
									 , N_USED = max(N_USED, na.rm = T)
									 , n_used = max(n_USED, na.rm = T)
	) %>%
	View()



noaa-garfo/discaRd documentation built on April 17, 2025, 10:32 p.m.