Skip to content

Commit

Permalink
Remove intermediate margins data and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
MoLi7 committed Mar 17, 2021
1 parent 1a51582 commit 688a400
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 222 deletions.
48 changes: 0 additions & 48 deletions R/DataDocumentation.R
Original file line number Diff line number Diff line change
Expand Up @@ -644,54 +644,6 @@
#' @source \url{https://apps.bea.gov/industry/xls/underlying-estimates/PEQBridge_2007_2012_DET.xlsx}
"Detail_PEQ_2012"

#' Detail Margins (Before Redef) table for 2012 (2012 schema)
#' @format A dataframe with 61844 obs. and 9 variables:
#' \describe{
#' \item{NIPACode}{text code}
#' \item{MarginsCategory}{text category name, like 'Therapeutic medical equipment'}
#' \item{CommodityCode}{BEA_2012_Detail_Code}
#' \item{CommodityDescription}{BEA_2012_Detail_Name}
#' \item{ProducersValue}{USD2012}
#' \item{Transportation}{USD2012}
#' \item{Wholesale}{USD2012}
#' \item{Retail}{USD2012}
#' \item{PurchasersValue}{USD2012}
#' }
#' @source \url{https://apps.bea.gov/industry/xls/underlying-estimates/Margins_Before_Redefinitions_2007_2012_DET.xlsx}
"Detail_Margins_2012_BeforeRedef"

#' Summary Margins (Before Redef) table for 2012 (2012 schema)
#' @format A dataframe with 4632 obs. and 9 variables:
#' \describe{
#' \item{NIPACode}{text code}
#' \item{MarginsCategory}{text category name, like 'Therapeutic medical equipment'}
#' \item{CommodityCode}{BEA_2012_Detail_Code}
#' \item{CommodityDescription}{BEA_2012_Detail_Name}
#' \item{ProducersValue}{USD2012}
#' \item{Transportation}{USD2012}
#' \item{Wholesale}{USD2012}
#' \item{Retail}{USD2012}
#' \item{PurchasersValue}{USD2012}
#' }
#' @source \url{https://apps.bea.gov/industry/xls/underlying-estimates/Margins_Before_Redefinitions_2007_2012_SUM.xlsx}
"Summary_Margins_2012_BeforeRedef"

#' Sector Margins (Before Redef) table for 2012 (2012 schema)
#' @format A dataframe with 4632 obs. and 9 variables:
#' \describe{
#' \item{NIPACode}{text code}
#' \item{MarginsCategory}{text category name, like 'Therapeutic medical equipment'}
#' \item{CommodityCode}{BEA_2012_Detail_Code}
#' \item{CommodityDescription}{BEA_2012_Detail_Name}
#' \item{ProducersValue}{USD2012}
#' \item{Transportation}{USD2012}
#' \item{Wholesale}{USD2012}
#' \item{Retail}{USD2012}
#' \item{PurchasersValue}{USD2012}
#' }
#' @source \url{https://apps.bea.gov/industry/xls/underlying-estimates/Margins_Before_Redefinitions_2007_2012_SECT.xlsx}
"Sector_Margins_2012_BeforeRedef"

#' Master Crosswalk table (2012 schema)
#' @format A dataframe with 16611 obs. and 6 variables:
#' \describe{
Expand Down
84 changes: 0 additions & 84 deletions data-raw/BEAData.R
Original file line number Diff line number Diff line change
Expand Up @@ -951,87 +951,3 @@ getBEADetailPEQBridge2012Schema <- function () {
}
Detail_PEQ_2012 <- getBEADetailPEQBridge2012Schema()[["2012"]]
usethis::use_data(Detail_PEQ_2012, overwrite = TRUE)

# Get Detail Margins (Before Redef, 2012 schema) 2007 and 2012 tables from BEA static URL
getBEADetailMarginsBeforeRedef2012Schema <- function () {
# Download BEA PCE bridge table
if(!file.exists("inst/extdata/Margins_Before_Redefinitions_2007_2012_DET.xlsx")) {
utils::download.file("https://apps.bea.gov/industry/xls/underlying-estimates/Margins_Before_Redefinitions_2007_2012_DET.xlsx",
"inst/extdata/Margins_Before_Redefinitions_2007_2012_DET.xlsx", mode = "wb")
}
column_names <- c("NIPACode", "MarginsCategory", "CommodityCode", "CommodityDescription",
"ProducersValue", "Transportation", "Wholesale", "Retail", "PurchasersValue")
# 2012 data
Margins2012 <- as.data.frame(readxl::read_excel("inst/extdata/Margins_Before_Redefinitions_2007_2012_DET.xlsx", sheet = "2012"))[5:61848, ]
colnames(Margins2012) <- column_names
# Convert Margins values from character to numeric
Margins2012[, column_names[5:9]] <- as.data.frame(apply(Margins2012[, column_names[5:9]], 2, as.numeric))
# 2007 data
Margins2007 <- as.data.frame(readxl::read_excel("inst/extdata/Margins_Before_Redefinitions_2007_2012_DET.xlsx", sheet = "2007"))[5:61844, ]
colnames(Margins2007) <- column_names
# Convert Margins values from character to numeric
Margins2007[, column_names[5:9]] <- as.data.frame(apply(Margins2007[, column_names[5:9]], 2, as.numeric))

# Put Margins2012 and Margins2007 in the Margins2012SchemaList
Margins2012SchemaList <- list(Margins2007, Margins2012)
names(Margins2012SchemaList) <- c("2007", "2012")
return(Margins2012SchemaList)
}
Detail_Margins_2012_BeforeRedef <- getBEADetailMarginsBeforeRedef2012Schema()[["2012"]]
usethis::use_data(Detail_Margins_2012_BeforeRedef, overwrite = TRUE)

# Get Summary Margins (Before Redef, 2012 schema) 2007 and 2012 tables from BEA static URL
getBEASummaryMarginsBeforeRedef2012Schema <- function () {
# Download BEA PCE bridge table
if(!file.exists("inst/extdata/Margins_Before_Redefinitions_2007_2012_SUM.xlsx")) {
utils::download.file("https://apps.bea.gov/industry/xls/underlying-estimates/Margins_Before_Redefinitions_2007_2012_SUM.xlsx",
"inst/extdata/Margins_Before_Redefinitions_2007_2012_SUM.xlsx", mode = "wb")
}
column_names <- c("NIPACode", "MarginsCategory", "CommodityCode", "CommodityDescription",
"ProducersValue", "Transportation", "Wholesale", "Retail", "PurchasersValue")
# 2012 data
Margins2012 <- as.data.frame(readxl::read_excel("inst/extdata/Margins_Before_Redefinitions_2007_2012_SUM.xlsx", sheet = "2012"))[5:4630, ]
colnames(Margins2012) <- column_names
# Convert Margins values from character to numeric
Margins2012[, column_names[5:9]] <- as.data.frame(apply(Margins2012[, column_names[5:9]], 2, as.numeric))
# 2007 data
Margins2007 <- as.data.frame(readxl::read_excel("inst/extdata/Margins_Before_Redefinitions_2007_2012_SUM.xlsx", sheet = "2007"))[5:4634, ]
colnames(Margins2007) <- column_names
# Convert Margins values from character to numeric
Margins2007[, column_names[5:9]] <- as.data.frame(apply(Margins2007[, column_names[5:9]], 2, as.numeric))

# Put Margins2012 and Margins2007 in the Margins2012SchemaList
Margins2012SchemaList <- list(Margins2007, Margins2012)
names(Margins2012SchemaList) <- c("2007", "2012")
return(Margins2012SchemaList)
}
Summary_Margins_2012_BeforeRedef <- getBEASummaryMarginsBeforeRedef2012Schema()[["2012"]]
usethis::use_data(Summary_Margins_2012_BeforeRedef, overwrite = TRUE)

# Get Sector Margins (Before Redef, 2012 schema) 2007 and 2012 tables from BEA static URL
getBEASectorMarginsBeforeRedef2012Schema <- function () {
# Download BEA PCE bridge table
if(!file.exists("inst/extdata/Margins_Before_Redefinitions_2007_2012_SECT.xlsx")) {
utils::download.file("https://apps.bea.gov/industry/xls/underlying-estimates/Margins_Before_Redefinitions_2007_2012_SECT.xlsx",
"inst/extdata/Margins_Before_Redefinitions_2007_2012_SECT.xlsx", mode = "wb")
}
column_names <- c("NIPACode", "MarginsCategory", "CommodityCode", "CommodityDescription",
"ProducersValue", "Transportation", "Wholesale", "Retail", "PurchasersValue")
# 2012 data
Margins2012 <- as.data.frame(readxl::read_excel("inst/extdata/Margins_Before_Redefinitions_2007_2012_SECT.xlsx", sheet = "2012"))[5:377, ]
colnames(Margins2012) <- column_names
# Convert Margins values from character to numeric
Margins2012[, column_names[5:9]] <- as.data.frame(apply(Margins2012[, column_names[5:9]], 2, as.numeric))
# 2007 data
Margins2007 <- as.data.frame(readxl::read_excel("inst/extdata/Margins_Before_Redefinitions_2007_2012_SECT.xlsx", sheet = "2007"))[5:377, ]
colnames(Margins2007) <- column_names
# Convert Margins values from character to numeric
Margins2007[, column_names[5:9]] <- as.data.frame(apply(Margins2007[, column_names[5:9]], 2, as.numeric))

# Put Margins2012 and Margins2007 in the Margins2012SchemaList
Margins2012SchemaList <- list(Margins2007, Margins2012)
names(Margins2012SchemaList) <- c("2007", "2012")
return(Margins2012SchemaList)
}
Sector_Margins_2012_BeforeRedef <- getBEASectorMarginsBeforeRedef2012Schema()[["2012"]]
usethis::use_data(Sector_Margins_2012_BeforeRedef, overwrite = TRUE)
Binary file removed data/Detail_Margins_2012_BeforeRedef.rda
Binary file not shown.
Binary file removed data/Sector_Margins_2012_BeforeRedef.rda
Binary file not shown.
Binary file removed data/Summary_Margins_2012_BeforeRedef.rda
Binary file not shown.
30 changes: 0 additions & 30 deletions man/Detail_Margins_2012_BeforeRedef.Rd

This file was deleted.

30 changes: 0 additions & 30 deletions man/Sector_Margins_2012_BeforeRedef.Rd

This file was deleted.

30 changes: 0 additions & 30 deletions man/Summary_Margins_2012_BeforeRedef.Rd

This file was deleted.

0 comments on commit 688a400

Please sign in to comment.