S_units_from_tidy: Extract an 'S_units' matrix from a tidy data frame

View source: R/munge_utilities.R

S_units_from_tidyR Documentation

Extract an S_units matrix from a tidy data frame

Description

The .tidydf should be grouped as needed.

Usage

S_units_from_tidy(
  .tidydf,
  Product = IEATools::iea_cols$product,
  Unit = IEATools::iea_cols$unit,
  S_units = Recca::psut_cols$S_units
)

Arguments

.tidydf

the data frame from which an S_units matrix is to be formed

Product

the name of the Product column in .tidydf. Default is "Product".

Unit

the name of the Unit column in .tidydf. Default is "Unit".

S_units

the name of the S_units column to be added to .tidydf. Default is "S_unit".

Value

a data frame containing grouping variables and a new S_unit column

Examples

library(dplyr)
library(matsindf)
library(Recca)
UKEnergy2000tidy |>
  group_by(Country, Year, EnergyType, LastStage) |>
  S_units_from_tidy()

MatthewHeun/Recca documentation built on Dec. 10, 2024, 10 p.m.