sum_quantities_by | R Documentation |
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 NA
s.
sum_annual_quantities_by()
is a specialized variant that always groups by year
.
sum_quantities_by( input_data, ..., digits = Inf, signif = Inf, verbose = getOption("verbose") ) sum_annual_quantities_by(...)
input_data |
(tabular) |
... |
variables to group by |
digits |
(integer) passed to |
signif |
(integer) passed to |
verbose |
(logical) |
annual_quantities_by(...)
is equivalent to sum_annual_quantities_by()
, but the latter is now preferred.
Other sum_by:
sum_emissions_by()
,
sum_throughputs_by()
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.