Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions R/DataDocumentation.R
Original file line number Diff line number Diff line change
Expand Up @@ -817,8 +817,8 @@
#' Detail Margins (Before Redef) table for 2017 (2017 schema)
#' @format A dataframe with 58051 obs. and 9 variables:
#' \describe{
#' \item{NIPACode}{text code}
#' \item{MarginsCategory}{text category name, like 'Therapeutic medical equipment'}
#' \item{IndustryCode}{text code}
#' \item{IndustryDescription}{text category name, like 'Therapeutic medical equipment'}
#' \item{CommodityCode}{BEA_2017_Detail_Code}
#' \item{CommodityDescription}{BEA_2017_Detail_Name}
#' \item{ProducersValue}{USD2017}
Expand All @@ -833,8 +833,8 @@
#' Detail Margins (Before Redef) table for 2012 (2017 schema)
#' @format A dataframe with 58032 obs. and 9 variables:
#' \describe{
#' \item{NIPACode}{text code}
#' \item{MarginsCategory}{text category name, like 'Therapeutic medical equipment'}
#' \item{IndustryCode}{text code}
#' \item{IndustryDescription}{text category name, like 'Therapeutic medical equipment'}
#' \item{CommodityCode}{BEA_2017_Detail_Code}
#' \item{CommodityDescription}{BEA_2017_Detail_Name}
#' \item{ProducersValue}{USD2017}
Expand Down
4 changes: 3 additions & 1 deletion R/LoadMargins.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ getMarginsTable <- function (model) {
# Change in inventory has negative margins for positive change, which does not accurately portray actual margins either.
purchaser_removal <- sapply(list("Export", "Import", "ChangeInventories"), getVectorOfCodes,
ioschema = model$specs$BaseIOSchema, iolevel = "Detail")
MarginsTable <- MarginsTable[!MarginsTable$NIPACode%in%purchaser_removal,]
# column names from Margins Tables from 2012 schema were not fixed
col <- ifelse("NIPACode" %in% names(MarginsTable), "NIPACode", "IndustryCode")
MarginsTable <- MarginsTable[!MarginsTable[[col]] %in% purchaser_removal,]
# Remove Scrap, Used and secondhand goods, and Non-comparable imports, and Rest of world adjustment commodities
commodity_removal <- sapply(list("Scrap", "UsedGoods", "NonComparableImport", "RoWAdjustment"), getVectorOfCodes,
ioschema = model$specs$BaseIOSchema, iolevel = model$specs$BaseIOLevel)
Expand Down
2 changes: 1 addition & 1 deletion data-raw/BEAData.R
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ getBEADetailMarginsBeforeRedef <- function(year, schema_year = NULL) {
# Trim table, assign column names
Margins <- Margins[!is.na(Margins[, 4]), ][-1, ]
rownames(Margins) <- NULL
colnames(Margins) <- c("NIPACode", "MarginsCategory",
colnames(Margins) <- c("IndustryCode", "IndustryDescription",
"CommodityCode", "CommodityDescription",
"ProducersValue", "Transportation",
"Wholesale", "Retail", "PurchasersValue")
Expand Down
Binary file modified data/Detail_Margins_2012_BeforeRedef_17sch.rda
Binary file not shown.
Binary file modified data/Detail_Margins_2017_BeforeRedef_17sch.rda
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"tool": ["useeior"],
"name_data": ["Detail_Margins_2012_BeforeRedef_17sch"],
"tool_version": ["1.5.2"],
"tool_version": ["1.7.2"],
"ext": ["json"],
"date_created": ["2024-05-26"],
"date_created": ["2025-07-28"],
"data_meta": {
"data_year": [2012],
"author": ["US Bureau of Economic Analysis"],
"source_url": ["https://apps.bea.gov/industry/xls/underlying-estimates/Margins_Before_Redefinitions_2017_DET.xlsx"],
"date_last_modified": ["2024-05-23"],
"date_accessed": ["2024-05-26"]
"date_accessed": ["2025-07-28"]
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"tool": ["useeior"],
"name_data": ["Detail_Margins_2017_BeforeRedef_17sch"],
"tool_version": ["1.5.2"],
"tool_version": ["1.7.2"],
"ext": ["json"],
"date_created": ["2024-05-26"],
"date_created": ["2025-07-28"],
"data_meta": {
"data_year": [2017],
"author": ["US Bureau of Economic Analysis"],
"source_url": ["https://apps.bea.gov/industry/xls/underlying-estimates/Margins_Before_Redefinitions_2017_DET.xlsx"],
"date_last_modified": ["2024-05-23"],
"date_accessed": ["2024-05-26"]
"date_accessed": ["2025-07-28"]
}
}
4 changes: 2 additions & 2 deletions man/Detail_Margins_2012_BeforeRedef_17sch.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/Detail_Margins_2017_BeforeRedef_17sch.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading