Processing for tables

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

Arguments

dat

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

group

A string identifying the indexing variable of the data. If you want to just summarize the data across all factors, set group = "none".

method

A string describing the method of summarizing data when group is set to "none". Options are "sum" or "mean". Default is "sum".

label

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

Value

A dataframe of processed data ready for formatting into a table. Input is an object created with filter_data.

Examples

{
  filtered <- filter_data(
    dat = stockplotr:::example_data,
    label_name = "landings",
    geom = "line",
    era = "time"
  )
  process_table(dat = filtered, method = "sum")
}
#> [[1]]
#> [[1]]$label
#> # A tibble: 147 × 3
#>     Year landings Uncertainty_landings
#>    <dbl>    <dbl>                <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()
#> 
#>