From c43676beccd1586a961a3510074d1743156466fe Mon Sep 17 00:00:00 2001 From: WesIngwersen Date: Fri, 15 Nov 2024 08:55:10 -0500 Subject: [PATCH] Updates to CalculateStateCBEI - add state and years to title - check for selection of >1 year - update text for requiring models built or downloaded - add TOC for tables --- examples/CalculateStateCBE.Rmd | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/examples/CalculateStateCBE.Rmd b/examples/CalculateStateCBE.Rmd index 17b9e70..55932a4 100644 --- a/examples/CalculateStateCBE.Rmd +++ b/examples/CalculateStateCBE.Rmd @@ -1,5 +1,5 @@ --- -title: Consumption-Based Greenhouse Gas Emissions Results Using a State EEIO Model +title: Consumption-Based Greenhouse Gas Emissions Results for `r params$state` for `r min(params$years)`- `r max(params$years)` date: '`r format(Sys.time(), "%B %d, %Y")`' output: officedown::rdocx_document: @@ -37,8 +37,8 @@ library(useeior) # devtools::load_all("../../useeior/") # Requires develop branch (to be v1.6.1) # Stop execution of Rmd if params not selected -if (params$state=="") { - stop("You must select a state and a year.") +if (params$state=="" || length(params$year) < 2) { + stop("You must select a state and at least two years.") } ## Select model build parameters @@ -69,7 +69,7 @@ for(y in years) { name_for_list <- paste0(state,"-",toString(y)) file_path <- file.path("..","models",paste0(modelname,".rds")) if(!file.exists(file_path)) { - stop("Please first build or download the requested model.") + stop("Please first build or download the models for the selected state and years.") } models[[name_for_list]] <- readRDS(file_path) } @@ -77,7 +77,7 @@ for(y in years) { ``` -*Table of Figures* +*List of Figures* ```{r echo=FALSE} library(officedown) library(officer) @@ -85,10 +85,15 @@ block_toc(seq_id = "fig") # or "tab" for tables # block_toc(style = "Image Caption") # or "Table Caption" for tables ``` +*List of Tables* +```{r echo=FALSE} +block_toc(seq_id = "tab") +``` + A consumption-based emissions inventory (CBEI) is an accounting method that can be applied to a region, including a state, that quantifies emissions associated with all goods and services consumed by a state, regardless of their origin. This approach allows these regions to account for more complete emissions caused by the consumption of goods in their region. -This document presents results for **`r state`** for the years **`r paste0(head(years, 1), "-", tail(years,1 ))`**. +This document presents results for **`r state`** for the years **`r paste0(min(years), "-", max(years))`**. Further details on the methods for calculating consumption based emissions (CBE) and interpreting CBEI results can be found in the associated EPA Report, [Consumption-Based Greenhouse Gas Inventories for Northeastern States](https://cfpub.epa.gov/si/si_public_search_results.cfm?simpleSearch=0&showCriteria=2&sortBy=pubDate&searchAll=consumption-based&TIMSType=Published+Report). ```{r calculate_results, include=FALSE}