diff --git a/R/DataDocumentation.R b/R/DataDocumentation.R index bd1d6033..c7d95dce 100644 --- a/R/DataDocumentation.R +++ b/R/DataDocumentation.R @@ -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{ diff --git a/data-raw/BEAData.R b/data-raw/BEAData.R index cb30d29d..4a0217d6 100644 --- a/data-raw/BEAData.R +++ b/data-raw/BEAData.R @@ -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) diff --git a/data/Detail_Margins_2012_BeforeRedef.rda b/data/Detail_Margins_2012_BeforeRedef.rda deleted file mode 100644 index 7c365f9c..00000000 Binary files a/data/Detail_Margins_2012_BeforeRedef.rda and /dev/null differ diff --git a/data/Sector_Margins_2012_BeforeRedef.rda b/data/Sector_Margins_2012_BeforeRedef.rda deleted file mode 100644 index 46b6b14a..00000000 Binary files a/data/Sector_Margins_2012_BeforeRedef.rda and /dev/null differ diff --git a/data/Summary_Margins_2012_BeforeRedef.rda b/data/Summary_Margins_2012_BeforeRedef.rda deleted file mode 100644 index 638e98b3..00000000 Binary files a/data/Summary_Margins_2012_BeforeRedef.rda and /dev/null differ diff --git a/man/Detail_Margins_2012_BeforeRedef.Rd b/man/Detail_Margins_2012_BeforeRedef.Rd deleted file mode 100644 index 48afdbe4..00000000 --- a/man/Detail_Margins_2012_BeforeRedef.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DataDocumentation.R -\docType{data} -\name{Detail_Margins_2012_BeforeRedef} -\alias{Detail_Margins_2012_BeforeRedef} -\title{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} -} -\usage{ -Detail_Margins_2012_BeforeRedef -} -\description{ -Detail Margins (Before Redef) table for 2012 (2012 schema) -} -\keyword{datasets} diff --git a/man/Sector_Margins_2012_BeforeRedef.Rd b/man/Sector_Margins_2012_BeforeRedef.Rd deleted file mode 100644 index 37e5320b..00000000 --- a/man/Sector_Margins_2012_BeforeRedef.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DataDocumentation.R -\docType{data} -\name{Sector_Margins_2012_BeforeRedef} -\alias{Sector_Margins_2012_BeforeRedef} -\title{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} -} -\usage{ -Sector_Margins_2012_BeforeRedef -} -\description{ -Sector Margins (Before Redef) table for 2012 (2012 schema) -} -\keyword{datasets} diff --git a/man/Summary_Margins_2012_BeforeRedef.Rd b/man/Summary_Margins_2012_BeforeRedef.Rd deleted file mode 100644 index 5e281011..00000000 --- a/man/Summary_Margins_2012_BeforeRedef.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DataDocumentation.R -\docType{data} -\name{Summary_Margins_2012_BeforeRedef} -\alias{Summary_Margins_2012_BeforeRedef} -\title{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} -} -\usage{ -Summary_Margins_2012_BeforeRedef -} -\description{ -Summary Margins (Before Redef) table for 2012 (2012 schema) -} -\keyword{datasets}