--- title: "Generate Supply Chain GHG Emission Factors Dataset v1.1.1" output: md_document: variant: gfm --- ### This file relies on the supply-chain-factors code. It was knitted from the main directory of ### the v.1.1.1 release. http://www.github.com/supply-chain-factors/tag/v1.1.1 ```{r, include=FALSE} knitr::opts_chunk$set(echo = FALSE) options(knitr.duplicate.label = "allow") SEF_version <- "v1.1.1" ``` ```{r set-params, include=FALSE} params_ls <- list() for (modelyear in 2010:2016) { for (modellevel in c("Detail", "Summary")) { for (modeltype in c("Commodity", "Industry")) { name <- paste(modelyear, modellevel, modeltype, sep = "_") params_ls[[name]] <- c("modelyear" = modelyear, "modellevel" = modellevel, "modeltype" = modeltype, "dollaryear" = 2018, "export-to-CSV" = "No") } } } ``` ```{r create-Excel, include=FALSE} table_ls <- list() Contents <- data.frame() for (name in names(params_ls)) { # Set params params <- as.list(params_ls[[name]]) # Knit child Rmd knitr::knit_child("CalculateEmissionFactors.Rmd", quiet = TRUE) # Prepare Contents sheet Contents_model <- as.data.frame(t(c(paste(params$modelyear, params$modellevel, params$modeltype, sep = "_"), paste("Supply chain emission factors (with and without margins) and Data Quality scores of the factors for", params$modelyear, "US", paste0(substr(tolower(params$modeltype), 1, nchar(tolower(params$modeltype))-1), "ies"), "at the BEA", tolower(params$modellevel), "level of categorization.")))) colnames(Contents_model) <- c("Sheet", "Description") Contents <- rbind.data.frame(Contents, Contents_model) # Generate LCIA factors LCIAFactors <- as.data.frame(t(model$C)) LCIAFactors[, "Other GHGs"] <- gsub("/.*", "", rownames(LCIAFactors)) LCIAFactors[, "GWP-100 Factors"] <- LCIAFactors[, "Other Greenhouse Gases"] LCIAFactors[, "Unit"] <- "kg CO2 eq." LCIAFactors <- LCIAFactors[LCIAFactors$`GWP-100 Factors`!=0, c("Other GHGs", "GWP-100 Factors", "Unit")] rownames(LCIAFactors) <- NULL # Assemble table table_ls[[name]] <- table } # Create Cover sheet Cover <- rbind.data.frame(c("Authors", "Wesley Ingwersen, Mo Li"), c("Description", paste("Tables presenting supply chain and margin emission factors and data quality scores", "for US commodities and industries calculated from USEEIO models", "at two levels of commodity/industry categorization, detail and summary,", "for both industries and commodity, and annually from 2010-2016.", "See the EPA report for full details on emission factor preparation.", "These factors were produced by knitting the GenerateEmissionFactorsDataset.Rmd file ", "in RStudio using the supply-chain-factors code, v1.1.1. (see Sources)")), c("DOI", "http://doi.org/10.23719/1524524")) colnames(Cover) <- c("Name", "Supply Chain GHG Emission Factors for US Commodities and Industries v1.1.1") # Create Data Dictionary sheet DataDictionary <- rbind.data.frame(c("Commodity/Industry Code", paste("Code of the commodity or industry from the BEA Make and Use Tables 2012 categorization.", "'Detail' and 'summary' are two levels of detail BEA publishes economic input-output accounts data at.", "'Detail' level is the most resolved categorization and includes 405 commodity or industry sectors.", "'Summary' level is a categorization with medium resolution and includes 73 commodity and 71 industry sectors.")), c("Commodity/Industry Name", paste("Name of the commodity or industry from the BEA Make and Use Tables 2012 categorization,", "except detail commodities, which use USEEIO v1.1 names, see Ingwersen and Yang 2017)")), c("Substance", paste("Greenhouse gas: 'carbon dioxide' is CO2; 'methane' is CH4; 'nitrous oxide' is N2O;", "and 'other GHGs' include HFC-23, HFC-32, HFC-125, HFC-134a, HFC-143a, HFC-236fa, CF4,", "C2F6, C3F8, C4F8, SF6, and NF3")), c("Unit", paste("Unit of emission factors for each gas.", "'Other Greenhouse Gases' are aggregated and reported in CO2e (carbon dioxide equivalents)", "using the IPCC AR4 100-year GWP factors.", "Purchaser price is the price paid by the consumer and equals to the producer prices plus any associated margin,", "which generally include distribution, wholesale and retail costs.")), c("Supply Chain Emission Factors without Margins", paste("Direct and indirect GHG emissions associated with production of commodity or industry", "from cradle to the point of production(kg) per 2018 USD of that commodity or industry", "in the US in purchaser price.")), c("Margins of Supply Chain Emission Factors", paste("Direct and indirect GHG emissions associated with production of commodity or industry", "from the point of production to the point of sale (kg) per 2018 USD of that commodity or industry", "in the US in purchaser price of that commodity or industry in the US.")), c("Supply Chain Emission Factors with Margins", paste("Direct and indirect GHG emissions associated with production of commodity or industry", "from cradle to the point of sale(kg) per 2018 USD of that commodity or industry", "in purchaser price of that commodity or industry in the US.")), c("DQ ReliabilityScore of Factors without Margins", paste("Data reliability scores for model results using USEPA 2016 Data quality assessment system,", "where 1 is the better quality and 5 the poorer quality")), c("DQ TemporalCorrelation of Factors without Margins", paste("Data technological correlation scores for model results using USEPA 2016 Data quality assessment system,", "where 1 is the better quality and 5 the poorer quality.")), c("DQ GeographicalCorrelation of Factors without Margins", paste("Data collection scores for model results using USEPA 2016 Data quality assessment system,", "where 1 is the better quality and 5 the poorer quality.")), c("DQ TechnologicalCorrelation of Factors without Margins", paste("Data geographical correlatoin scores for model results using USEPA 2016 Data quality assessment system,", "where 1 is the better quality and 5 the poorer quality.")), c("DQ DataCollection of Factors without Margins", paste("Data temporal correlation scores for model results using USEPA 2016 Data quality assessment system,", "where 1 is the better quality and 5 the poorer quality."))) colnames(DataDictionary) <- c("Field Name", "Definition") # Create Sources sheet Sources <- rbind.data.frame(c("Supply Chain Greenhouse Gas Emission Factors for US Industries and Commodities, USEPA Report", "Wesley Ingwersen, Mo Li", "2020", "https://cfpub.epa.gov/si/si_public_record_report.cfm?dirEntryId=349324"), c("Guidance on Data Quality Assessment for Life Cycle Inventory Data", "USEPA", "2016", "https://cfpub.epa.gov/si/si_public_record_report.cfm?dirEntryId=321834"), c("Input-Output Accounts Data", "BEA", "2012", "https://www.bea.gov/industry/input-output-accounts-data"), c("supply-chain-factors v1.1.1", "Mo Li, Wesley Ingwersen", "2022", "https://github.com/USEPA/supply-chain-factors/releases/tag/v1.1.1")) colnames(Sources) <- c("Title", "Author", "Year", "Link") # Compile and write to Excel workbook writexl::write_xlsx(c(list("Cover" = Cover, "Contents" = Contents, "Data Dictionary" = DataDictionary, "Sources" = Sources, "LCIA Factors of Other GHGs" = LCIAFactors), table_ls), paste0("SupplyChainEmissionFactorsforUSIndustriesCommodities ", SEF_version, ".xlsx")) ```