Learn R Programming

carbonr (version 0.2.1)

total_output: Calculate Total Output and Generate Plot

Description

This function calculates the total output and generates a plot based on the specified parameters.

Usage

total_output(
  data = x$data,
  time = time,
  date_format = c("%d/%m/%Y"),
  name = theatre,
  val = carbon_price_credit,
  plot_by = c("default", "month", "year")
)

Value

A ggplot object showing the total output plot.

Arguments

data

The data frame containing the data.

time

The variable representing the time dimension.

date_format

The date format for the time variable (optional, default: c("%d/%m/%Y")).

name

The variable representing the grouping variable.

val

The variable to calculate the total output for (default: carbon_price_credit).

plot_by

The grouping type for the total output plot ("default", "month", "year").

Details

This function calculates the total output by grouping the data based on the specified parameters (grouping variable and time dimension). It then summarises the specified variable (CPI or emissions) using the sum function. The resulting data is used to create a line plot showing the total output over time, with each group represented by a different color. The plot can be grouped by the default grouping, month, or year, based on the plot_by parameter.