Filter data for input into aesthetics for ggplot2

filter_data(
  dat,
  label_name,
  module = NULL,
  era = NULL,
  geom,
  group = NULL,
  facet = NULL,
  scale_amount = 1,
  interactive = TRUE
)

Arguments

dat

Data frame or list. A tibble or named list of tibbles (input as `list()`) returned from convert_output.

If inputting a list of tibbles, the first tibble's reference point defined in `ref_line` is used to plot a reference line or calculate relative spawning biomass.

label_name

String. Name of the label used to filter the data.

module

Character vector. (Optional) Module name found in `dat`. If selecting >1 module, place them in a vector like c("module1", "module2").

Default: NULL

If the interactive and >1 module_name is found, user will select the module_name in the console. @seealso [filter_data()]

era

String. Era of data.

Default: "time"

Options: "early", "time", "fore" (forecast), or NULL (all data)

geom

String. Geom used for the plot.

Default: "line".

Options: "line", "point", or "area"

group

String. Single column that groups the data.

Set group = "none" to summarize data over all indexing values.

Default: NULL Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL

facet

Character vector. Column name or names used for faceting.

Default: NULL

scale_amount

Number. A number to scale the y-axis values.

Default: 1

interactive

Logical. TRUE/FALSE; indicate whether the environment is interactive.

Default: `FALSE`

Value

a data frame that is preformatted for plotting with ggplot2.

Examples

if (FALSE) { # \dontrun{
filter_data(dat, "biomass", "line", group = "fleet")
} # }