sum_quantities_by: Sum Quantities In Tabular Data

sum_quantities_byR Documentation

Sum Quantities In Tabular Data

Description

All of the variables in input_data whose names end in _qty will be summed. Corresponding variables whose names end in _unit will be preserved. Ignores NAs.

sum_annual_quantities_by() is a specialized variant that always groups by year.

Usage

sum_quantities_by(
  input_data,
  ...,
  digits = Inf,
  signif = Inf,
  verbose = getOption("verbose")
)

sum_annual_quantities_by(...)

Arguments

input_data

(tabular)

...

variables to group by

digits

(integer) passed to total()

signif

(integer) passed to total()

verbose

(logical)

Note

annual_quantities_by(...) is equivalent to sum_annual_quantities_by(), but the latter is now preferred.

See Also

Other sum_by: sum_emissions_by(), sum_throughputs_by()

Examples

df <- tibble(year = 1990:1993, foo = rep(c("bar", "baz"), 2), ems_qty = 1:4, ems_unit = "ton/yr")
df %>% sum_quantities_by(foo, verbose = TRUE)
df %>% sum_quantities_by("year", foo, verbose = TRUE)
df %>% sum_quantities_by("year", foo, digits = 2, verbose = TRUE)

df <- tibble(year = 1990:1993, foo = rep(c("bar", "baz"), 2), ems_qty = 1:4, ems_unit = "ton/yr")
df %>% sum_annual_quantities_by(foo, verbose = TRUE)


BAAQMD/qtytools documentation built on June 30, 2022, 6:07 p.m.