Aggregate the catch data contained in a catch dataset and update the biomass dataset with the subtracted catch.
spm_aggregate_catch(
biomass,
catch,
biomass_variable,
catch_variable,
corrections = NULL,
fun = sum,
group_by = "spacetime",
fill,
apply_to_df = FALSE,
...
)
# S4 method for sspm_dataset,sspm_dataset,character,character
spm_aggregate_catch(
biomass,
catch,
biomass_variable,
catch_variable,
corrections = NULL,
fun = sum,
group_by = "spacetime",
fill,
apply_to_df = FALSE,
...
)
[sspm_dataset (smoothed)] The dataset containing the biomass variable.
[sspm_dataset] The dataset containing the catch variable.
[character] The biomass variab of biomass
.
[character] The catch column of catch
.
[data.frame] Optional landings corrections.
[function] Function to use to aggregate data.
[character] One of time
, space
and spacetime
.
[logical OR numeric OR function] Whether to complete the
incomplete cases, default to FALSE
for no completion.
[logical] Wether fun
applied to the data frame
group or to variable
, default to FALSE
.
More arguments passed onto fun
Updated sspm_dataset
.
if (FALSE) {
spm_aggregate_catch(biomass = biomass_smooth, catch = catch_dataset,
biomass_variable = "weight_per_km2",
catch_variable = "catch",
fill = mean)
}