g3_data | R Documentation |
Aggregates data from a data frame ready to be passed to gadget3. Useful for generating datasets for g3l_catchdistribution
, g3l_abundancedistribution
and g3_timeareadata
. Imitates the behavior of mfdb_sample_*
functions and returns the required object attributes as instructed by the params
argument.
g3_data(
x,
params = list(),
method = "count",
column_names = c(year = "year", step = "month", area = "areacell"),
floating_point_correction = TRUE,
verbose = FALSE
)
x |
A data frame, tibble or data table |
params |
A list of parameters defining the grouping. See details in |
method |
A character defining the aggregation method: use |
column_names |
A named vector explaining the column names which gadget3 expects in |
floating_point_correction |
Logical indicating whether 1e-6 should be added to all numeric columns except for |
verbose |
Logical indicating whether the function should return messages about potential assumptions when expected data are not specified. |
This function attempts to do the same than mfdb_sample_*
functions: summarise data ready for gadget3, with the difference that this function uses dataframes instead of a SQL database as input data. Consequently, this function should be independent of mfdb if the functions that generate groups and intervals as the mfdb package (mfdb_interval
, mfdb_group
) were imported to a project with this function.
Importantly, g3_data()
does not attempt to filter other data than length unlike mfdb_sample_*
functions that filter all columns passed to params
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.