Processing for tables

process_table(dat, group = NULL, method = "sum", label = NULL, digits = 2)

Arguments

dat

Pre-filtered data from filter_data following a long format data.

group

A string identifying the indexing variable of the data. To remove any groups and summarize data across all factors, set group = "none". Setting group = NULL will keep any grouping variables identified in the data by the function.

Default: NULL

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

method

A string describing the method of summarizing data when group is set to "none".

Default: "sum"

Options: "sum" or "mean"

label

A string or vector of strings identifying the label values to filter the data.

Default: NULL

digits

Numeric value indicating the number of rounding digits.

Default: 2

Value

A dataframe of processed data ready for formatting into a table.

Details

Input is an object created with filter_data.

Examples

{
  filtered <- filter_data(
    dat = stockplotr:::example_data,
    label = "landings",
    geom = "line",
    era = "time"
  )
  process_table(dat = filtered, method = "sum")
}
#> [[1]]
#> [[1]]$label
#> # A tibble: 147 × 3
#>     Year landings Uncertainty_landings
#>    <dbl> <chr>                   <dbl>
#>  1  1876 NA                         NA
#>  2  1877 NA                         NA
#>  3  1878 NA                         NA
#>  4  1879 NA                         NA
#>  5  1880 NA                         NA
#>  6  1881 NA                         NA
#>  7  1882 NA                         NA
#>  8  1883 NA                         NA
#>  9  1884 NA                         NA
#> 10  1885 NA                         NA
#> # ℹ 137 more rows
#> 
#> 
#> [[2]]
#> named character(0)
#> 
#> [[3]]
#> [[3]]$label
#> named list()
#> 
#>