R/spm_aggregate.R
spm_aggregate.Rd
Aggregate the data contained in a dataset or fit based on the discretized boundaries, using a function and a filling value.
spm_aggregate(
sspm_object,
boundaries,
level = "patch",
type = "data",
variable,
fun,
group_by = "spacetime",
fill = FALSE,
apply_to_df = FALSE,
...
)
# S4 method for sspm_dataset,missing
spm_aggregate(
sspm_object,
boundaries,
level = "patch",
type = "data",
variable,
fun,
group_by = "spacetime",
fill = FALSE,
apply_to_df = FALSE,
...
)
# S4 method for sspm_dataset,sspm_discrete_boundary
spm_aggregate(
sspm_object,
boundaries,
level = "patch",
type = "data",
variable,
fun,
group_by = "spacetime",
fill = FALSE,
apply_to_df = FALSE,
...
)
[sspm_dataset or sspm_fit] The dataset object.
[sspm_discrete_boundary] The boundaries object (optionnal).
[character] The aggregation level, "patch" or "boundary".
[character] The targeted type of aggregation, one of "data" for base data or "smoothed" for smoothed data.
[character] Variable to aggregate (ignored in case
apply_to_df
is TRUE
).
[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
or sspm_fit
.
if (FALSE) {
spm_aggregate(sspm_object = catch,
boundaries = spm_boundaries(biomass),
variable = catch_variable,
fun = fun, group_by = group_by,
fill = fill, apply_to_df = apply_to_df,
na.rm = TRUE, ...)
}