Description Usage Arguments Author(s) See Also Examples
View source: R/change_em_binning.r
change_em_binning
alters the bin structure for the population and
length composition data in an SS estimation model. It is done by taking the
original length composition info from the EM ss3.dat
then changing
according to the user's specification. If the data file also contails
conditional age-at-length data then these data will be re-binned as well.
1 2 3 |
dat_list |
An SS data list object as read in from
|
dat_file_out |
A string providing the path to the output SS3 |
bin_vector |
A numeric vector of new length bins to substitute into the
|
lbin_method |
A numeric value of either |
pop_binwidth |
*Population length bin width. Only necessary for
|
pop_minimum_size |
*Population minimum length bin value. 'Only
necessary for |
pop_maximum_size |
*Population maximum length bin value. Only
necessary for |
write_file |
Should the |
Kotaro Ono (length-composition rebinning), Sean Anderson (conditional age-at-length rebinning)
Other change functions: change_data
,
change_e
, change_f
,
change_maturity
,
change_retro
, change_tv
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | d <- system.file("extdata", package = "ss3sim")
f_in <- paste0(d, "/example-om/data.ss_new")
dat_list <- r4ss::SS_readdat(file = f_in, verbose = FALSE)
l <- change_em_binning(dat_list, dat_file_out = NULL, lbin_method = 1,
bin_vector = seq(8, 30, by = 1), write_file = FALSE)
print(l$lbin_vector)
print(head(l$lencomp))
# An small example with conditional age-at-length re-binning:
f <- system.file("extdata", "models", "cod-om", "codOM.dat", package = "ss3sim")
d <- r4ss::SS_readdat(f, verbose = FALSE)
# Add catch at length data (and simplify the bin structure for this example)
olddat <- change_data(d, outfile = NULL, write_file = FALSE,
types = c("len", "age", "cal"), fleets = 1, years = seq(2000, 2002),
age_bins = 1:3, len_bins = 4:8)
olddat$agecomp
newdat <- change_em_binning(olddat, dat_file_out = NULL, bin_vector = c(4, 6, 8),
lbin_method = 1, write_file = FALSE)
newdat$agecomp
# A larger conditional age-at-length re-rebinning example:
olddat <- change_data(d, outfile = NULL, write_file = FALSE,
types = c("len", "age", "cal"), fleets = 1, years = seq(2000, 2005),
age_bins = seq(1, 5), len_bins = round(seq(20, 30, length.out = 13), 1))
olddat$lbin_vector
head(olddat$lencomp)
head(olddat$agecomp)
newdat <- change_em_binning(olddat, dat_file_out = NULL, bin_vector = seq(20, 30, 2),
lbin_method = 1, write_file = FALSE)
newdat$lbin_vector
head(newdat$lencomp)
newdat$agecomp
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.