M DESCRIPTION => DESCRIPTION +5 -5
@@ 1,8 1,8 @@
Package: epidata
Type: Package
Title: Tools to Retrieve Economic Policy Institute Data Library Extracts
-Version: 0.2.0
-Date: 2018-03-29
+Version: 0.3.0
+Date: 2019-04-11
Authors@R: c(person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre")))
Maintainer: Bob Rudis <bob@rud.is>
Encoding: UTF-8
@@ 12,8 12,8 @@ Description: The Economic Policy Institute (<http://www.epi.org/>) provides
from Economic Policy Institute analysis of government data sources. Use
it to research wages, inequality, and other economic indicators over time
and among demographic groups. Data is usually updated monthly.
-URL: https://github.com/hrbrmstr/epidata
-BugReports: https://github.com/hrbrmstr/epidata/issues
+URL: https://gitlab.com/hrbrmstr/epidata
+BugReports: https://gitlab.com/hrbrmstr/epidata/issues
License: AGPL
Suggests:
testthat
@@ 29,4 29,4 @@ Imports:
tidyr,
readr,
stringi
-RoxygenNote: 6.0.1.9000
+RoxygenNote: 6.1.1
M NAMESPACE => NAMESPACE +4 -0
@@ 1,8 1,10 @@
# Generated by roxygen2: do not edit by hand
export(get_annual_wages_and_work_hours)
+export(get_annual_wages_by_wage_group)
export(get_black_white_wage_gap)
export(get_college_wage_premium)
+export(get_compensation_wages_and_benefits)
export(get_employment_to_population_ratio)
export(get_gender_wage_gap)
export(get_health_insurance_coverage)
@@ 10,8 12,10 @@ export(get_hispanic_white_wage_gap)
export(get_labor_force_participation_rate)
export(get_long_term_unemployment)
export(get_median_and_mean_wages)
+export(get_minimum_wage)
export(get_non_high_school_wage_penalty)
export(get_pension_coverage)
+export(get_poverty_level_wages)
export(get_productivity_and_hourly_compensation)
export(get_underemployment)
export(get_unemployment)
M NEWS.md => NEWS.md +8 -9
@@ 1,10 1,9 @@
-0.2.0
-* WIP
-* Added new `get_` functions for new data sources provided by the EPI
-* Fixed issues with different return values for some hidden API calls
-* Updated to use new https
+# epidata 0.3.0
-0.1.0
-* Passes CRAN checks
-* Complete EPI SWADL hidden API coverage
-* Initial release
+* Added a `NEWS.md` file to track changes to the package.
+* Added a package user-agent to httr calls
+* Changed http: epidata URLS to https:
+* Moved DESCRIPTION refs to GitLab
+* Fixed CRAN check errors due to new epidata API endpoint
+* Added 4 new data sources: "Annual wages by wage group",
+ "Compensation, wages, and benefits", "Minimum wage", "Poverty-level wages"
M R/aaa.r => R/aaa.r +9 -0
@@ 1,1 1,10 @@
globalVariables(c("date", "region", "value"))
+
+
+httr::user_agent(
+ sprintf(
+ "epidata package v%s: (<%s>)",
+ utils::packageVersion("epidata"),
+ utils::packageDescription("epidata")$URL
+ )
+) -> .EPIDATA_UA
A R/annual-wages-by-wage-group.R => R/annual-wages-by-wage-group.R +51 -0
@@ 0,0 1,51 @@
+#' Annual wages by wage group
+#'
+#' Return the average annual salaries for select wage groups, with particular focus on
+#' the highest wage earners. Note that this data is not directly comparable to wage
+#' deciles/percentiles.
+#'
+#' Wages are in 2017 dollars. Population sample: All workers.
+#'
+#' The average annual wages by wage group are taken from a 2010 article by Wojciech Kopczuk,
+#' Emmanuel Saez, and Jae Song. To extend this series, data for 2006 through 2017 are
+#' extrapolated from 2004 data using changes in wage shares computed from Social Security
+#' Administration wage statistics. We employ the midpoint of the bracket to compute total
+#' wage income in each bracket and sum all brackets. We then use interpolation to derive
+#' percentile cutoffs building from the bottom up to obtain the 0–90th percentile bracket
+#' and then estimate the remaining categories. This allows us to estimate the wage shares
+#' for upper wage groups. We use these wage shares computed for 2004 and later years to
+#' extend the Kopczuk, Saez, and Song series by adding the changes in share between 2004
+#' and the relevant year to their series. To obtain absolute wage trends we use the SSA data
+#' on the total wage pool and employment and compute the real wage per worker (based on t
+#' heir share of wages and employment) in the different groups in 2017 dollars. For a
+#' detailed explanation, see the methodology for annual wages and hours.
+#'
+#' @return \code{tbl_df} with data filtered by the selected criteria.
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @note Data source: SSA | Kopczuk, Saez, and Song (2010)
+#' @export
+#' @examples
+#' get_annual_wages_by_wage_group()
+get_annual_wages_by_wage_group <- function() {
+
+ params <- list(subject="wagegroup")
+
+ res <- epi_query(params)
+
+ cols <- stringi::stri_trans_tolower(res$columns$name)
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('%\\)]", "")
+ cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
+ rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
+ "_")
+ cols <- stringi::stri_replace_first_regex(cols, "([[:digit:]])", "x_$1")
+
+ out <- setNames(as_data_frame(res$data), cols)
+ out <- dplyr::mutate_all(out, "clean_cols")
+ out <- suppressMessages(readr::type_convert(out))
+
+ cite <- html_text(read_html(res$meta$source %||% "<p>Economic Policy Institute</p>"))
+ message(sprintf('Note: %s\nCitation: "%s"', res$meta$notes %||% "None", cite))
+
+ out
+
+}
A R/compensation-wages-benefits.R => R/compensation-wages-benefits.R +40 -0
@@ 0,0 1,40 @@
+#' Compensation, wages, and benefits
+#'
+#' Return the nonwage payments, referred to as fringe benefits, and wages.
+#' Compensation includes employer payments for health insurance, pensions,
+#' and payroll taxes (primarily payments toward Social Security and unemployment insurance).
+#'
+#' Wages are in 2016 dollars. Wage and salary workers (NIPA) | Private-sector workers (ECEC)
+#'
+#' @return \code{tbl_df} with data filtered by the selected criteria.
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @note Data source: NIPA | ECEC
+#' @export
+#' @examples
+#' get_compensation_wages_and_benefits()
+get_compensation_wages_and_benefits <- function() {
+
+ params <- list(subject="compben")
+
+ res <- epi_query(params)
+
+ cols <- stringi::stri_trans_tolower(res$columns$name)
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('%,\\)]", "")
+ cols <- stringi::stri_replace_all_fixed(cols, "&", "_and_")
+ cols <- stringi::stri_replace_all_fixed(cols, "/", "_")
+ cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
+ rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
+ "_")
+ cols <- stringi::stri_replace_first_regex(cols, "([[:digit:]])", "x_$1")
+ cols <- stringi::stri_replace_all_regex(cols, "_+", "_")
+
+ out <- setNames(as_data_frame(res$data), cols)
+ out <- dplyr::mutate_all(out, "clean_cols")
+ out <- suppressMessages(readr::type_convert(out))
+
+ cite <- html_text(read_html(res$meta$source %||% "<p>Economic Policy Institute</p>"))
+ message(sprintf('Note: %s\nCitation: "%s"', res$meta$notes %||% "None", cite))
+
+ out
+
+}
M R/employment.r => R/employment.r +12 -6
@@ 5,7 5,7 @@
#' unemployment data by gender, race and education, you would set this parameter to "\code{gre}".
#' @return \code{tbl_df} with data filtered by the selected criteria.
#' @note See \code{get_unemployment_by_state()} for information on retrieving unemployment by state+race.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @export
#' @examples
#' get_unemployment()
@@ 22,6 22,7 @@ get_unemployment <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
@@ 41,7 42,7 @@ get_unemployment <- function(by=NULL) {
#' @param by \code{NULL} or \code{r} for a partition by race.
#' @return \code{tbl_df} with data filtered by the selected criteria.
#' @note See \code{get_unemployment()} for other unemployment extracts..
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @export
#' @examples
#' get_unemployment_by_state()
@@ 56,6 57,7 @@ get_unemployment_by_state <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
@@ 77,7 79,7 @@ get_unemployment_by_state <- function(by=NULL) {
#' \code{r} (Race), \code{a} (Age), \code{e} (Education). i.e. if you want to retrieve
#' unemployment data by gender, race and education, you would set this parameter to "\code{gre}".
#' @return \code{tbl_df} with data filtered by the selected criteria.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @export
#' @examples
#' get_long_term_unemployment()
@@ 94,6 96,7 @@ get_long_term_unemployment <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
@@ 120,7 123,7 @@ get_long_term_unemployment <- function(by=NULL) {
#' \code{r} (Race), \code{a} (Age), \code{e} (Education). i.e. if you want to retrieve
#' unemployment data by gender, race and education, you would set this parameter to "\code{gre}".
#' @return \code{tbl_df} with data filtered by the selected criteria.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @export
#' @examples
#' get_underemployment()
@@ 137,6 140,7 @@ get_underemployment <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
@@ 159,7 163,7 @@ get_underemployment <- function(by=NULL) {
#' \code{r} (Race), \code{a} (Age), \code{e} (Education). i.e. if you want to retrieve
#' unemployment data by gender, race and education, you would set this parameter to "\code{gre}".
#' @return \code{tbl_df} with data filtered by the selected criteria.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @export
#' @examples
#' get_labor_force_participation_rate()
@@ 176,6 180,7 @@ get_labor_force_participation_rate <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
@@ 197,7 202,7 @@ get_labor_force_participation_rate <- function(by=NULL) {
#' unemployment data by gender, race and education, you would set this parameter to "\code{gre}".
#' @return \code{tbl_df} with data filtered by the selected criteria.
#' @export
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @examples
#' get_employment_to_population_ratio()
#'
@@ 213,6 218,7 @@ get_employment_to_population_ratio <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
M R/epi_query.r => R/epi_query.r +8 -3
@@ 4,10 4,15 @@ epi_query <- function(args) {
qs <- paste(sprintf("%s=%s", names(args), args), collapse="&")
httr::POST(
- "https://www.epi.org/wp-admin/admin-ajax.php",
+ "https://www.epi.org/wordpress/wp-admin/admin-ajax.php",
httr::add_headers(`X-Requested-With`="XMLHttpRequest"),
- encode="form",
- body=list(action="epi_getdata", queryString = qs)) -> res
+ .EPIDATA_UA,
+ encode = "form",
+ body = list(
+ action = "epi_getdata",
+ queryString = qs
+ )
+ ) -> res
httr::stop_for_status(res)
M R/epidata-package.R => R/epidata-package.R +1 -0
@@ 9,6 9,7 @@
#' @name epidata
#' @docType package
#' @author Bob Rudis (bob@@rud.is)
+#' @keywords internal
#' @importFrom purrr map map_df map_chr keep discard %||%
#' @importFrom stringi stri_replace_all_regex stri_trans_tolower %s+% stri_replace_all_fixed
#' @importFrom dplyr %>% as_data_frame mutate_all
M R/gaps.r => R/gaps.r +12 -11
@@ 16,7 16,7 @@
#'
#' @param by \code{NULL} or \code{r} for a parition by race
#' @return \code{tbl_df} with data filtered by the selected criteria.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @export
#' @examples
#' get_gender_wage_gap()
@@ 31,7 31,7 @@ get_gender_wage_gap <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
- cols <- stringi::stri_replace_all_regex(cols, "[\\(\\)]", "")
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
@@ 65,7 65,7 @@ get_gender_wage_gap <- function(by=NULL) {
#'
#' @param by \code{NULL} or \code{g} for a parition by gender
#' @return \code{tbl_df} with data filtered by the selected criteria.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @export
#' @examples
#' get_black_white_wage_gap()
@@ 80,7 80,7 @@ get_black_white_wage_gap <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
- cols <- stringi::stri_replace_all_regex(cols, "[\\(\\)]", "")
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
@@ 114,7 114,7 @@ get_black_white_wage_gap <- function(by=NULL) {
#'
#' @param by \code{NULL} or \code{g} for a parition by gender
#' @return \code{tbl_df} with data filtered by the selected criteria.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @export
#' @examples
#' get_hispanic_white_wage_gap()
@@ 129,7 129,7 @@ get_hispanic_white_wage_gap <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
- cols <- stringi::stri_replace_all_regex(cols, "[\\(\\)]", "")
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
@@ 154,7 154,7 @@ get_hispanic_white_wage_gap <- function(by=NULL) {
#'
#' @param by \code{NULL} or \code{g} for a parition by gender
#' @return \code{tbl_df} with data filtered by the selected criteria.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @export
#' @examples
#' get_college_wage_premium()
@@ 169,7 169,7 @@ get_college_wage_premium <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
- cols <- stringi::stri_replace_all_regex(cols, "[\\(\\)]", "")
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
@@ 195,7 195,7 @@ get_college_wage_premium <- function(by=NULL) {
#'
#' @param by \code{NULL} or \code{g} for a parition by gender
#' @return \code{tbl_df} with data filtered by the selected criteria.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @export
#' @examples \dontrun{
#' get_non_high_school_wage_penalty()
@@ 211,7 211,7 @@ get_non_high_school_wage_penalty <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
- cols <- stringi::stri_replace_all_regex(cols, "[\\(\\)]", "")
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
@@ 243,7 243,7 @@ get_non_high_school_wage_penalty <- function(by=NULL) {
#' \code{r} (Race), i.e. if you want to retrieve
#' unemployment data by gender and race, you would set this parameter to "\code{gr}".
#' @return \code{tbl_df} with data filtered by the selected criteria.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @export
#' @examples \dontrun{
#' get_wage_ratios()
@@ 264,6 264,7 @@ get_wage_ratios <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
M R/health.r => R/health.r +2 -1
@@ 11,7 11,7 @@
#' i.e. if you want to retrieve unemployment data by gender and race, you would set this
#' parameter to "\code{gr}".
#' @return \code{tbl_df} with data filtered by the selected criteria.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @note Data source: CPS ASEC
#' @export
#' @examples
@@ 32,6 32,7 @@ get_health_insurance_coverage <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
A R/minimum-wage.R => R/minimum-wage.R +43 -0
@@ 0,0 1,43 @@
+#' Minimum wage
+#'
+#' Return tthe hourly minimum wage set by federal law. The real minimum wage is the federal
+#' hourly minimum wage adjusted for inflation.
+#'
+#' Wages are in 2016 dollars, excluding the nominal federal minimum wage. Share of average
+#' wages based on the average wages of production and nonsupervisory workers. For state
+#' minimum wages, see EPI’s minimum wage tracker.
+#'
+#' Population sample: Production and nonsupervisory workers (average wages)
+#'
+#' @return \code{tbl_df} with data filtered by the selected criteria.
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @note Data source: U.S. Department of Labor Wage and Hour Division | CES
+#' @export
+#' @examples
+#' get_minimum_wage()
+get_minimum_wage <- function() {
+
+ params <- list(subject="minwage")
+
+ res <- epi_query(params)
+
+ cols <- stringi::stri_trans_tolower(res$columns$name)
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('%,\\)]", "")
+ cols <- stringi::stri_replace_all_fixed(cols, "&", "_and_")
+ cols <- stringi::stri_replace_all_fixed(cols, "/", "_")
+ cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
+ rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
+ "_")
+ cols <- stringi::stri_replace_first_regex(cols, "([[:digit:]])", "x_$1")
+ cols <- stringi::stri_replace_all_regex(cols, "_+", "_")
+
+ out <- setNames(as_data_frame(res$data), cols)
+ out <- dplyr::mutate_all(out, "clean_cols")
+ out <- suppressMessages(readr::type_convert(out))
+
+ cite <- html_text(read_html(res$meta$source %||% "<p>Economic Policy Institute</p>"))
+ message(sprintf('Note: %s\nCitation: "%s"', res$meta$notes %||% "None", cite))
+
+ out
+
+}
M R/pension.r => R/pension.r +2 -1
@@ 11,7 11,7 @@
#' i.e. if you want to retrieve pension data by gender and race, you would set this
#' parameter to "\code{gr}".
#' @return \code{tbl_df} with data filtered by the selected criteria.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @note Data source: CPS ASEC
#' @export
#' @examples
@@ 32,6 32,7 @@ get_pension_coverage <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
A R/poverty.R => R/poverty.R +51 -0
@@ 0,0 1,51 @@
+#' Poverty-level wages
+#'
+#' Return the share of workers earning equal to or less than the poverty-level wage, or
+#' the hourly wage that a full-time, year-round worker must earn to sustain a family of
+#' four with two children at the official poverty threshold.
+#'
+#' Population sample: Wage and salary workers age 18–64. Data source: CPS ORG | Census
+#' Bureau (poverty threshold)
+#'
+#' @param by \code{NULL} or character string with any combination of \code{g} (Gender) or
+#' \code{r} (Race), i.e. if you want to retrieve
+#' unemployment data by gender and race, you would set this parameter to "\code{gr}".
+#' @return \code{tbl_df} with data filtered by the selected criteria.
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @export
+#' @examples \dontrun{
+#' get_poverty_level_wages()
+#'
+#' get_poverty_level_wages("r")
+#'
+#' get_poverty_level_wages("gr")
+#' }
+get_poverty_level_wages <- function(by=NULL) {
+
+ params <- list(subject="povwage")
+
+ if (!is.null(by)) {
+ params <- make_params(params, by, c("g", "r"))
+ # params <- c(params, list(subject="wage", d="10,50,95,5010,9550,mean"))
+ }
+
+ res <- epi_query(params)
+
+ cols <- stringi::stri_trans_tolower(res$columns$name)
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('%\\+\\)]", "")
+ cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
+ rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
+ "_")
+ cols <- stringi::stri_replace_first_regex(cols, "([[:digit:]])", "x_$1")
+ cols <- stringi::stri_replace_all_regex(cols, "_+", "_")
+
+ out <- setNames(as_data_frame(res$data), cols)
+ out <- dplyr::mutate_all(out, "clean_cols")
+ out <- suppressMessages(readr::type_convert(out))
+
+ cite <- html_text(read_html(res$meta$source %||% "<p>Economic Policy Institute</p>"))
+ message(sprintf('Note: %s\nCitation: "%s"', res$meta$notes %||% "None", cite))
+
+ out
+
+}
M R/productivity.r => R/productivity.r +2 -1
@@ 11,7 11,7 @@
#'
#' @param by \code{NULL} or character string of \code{g} (Gender)
#' @return \code{tbl_df} with data filtered by the selected criteria.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @note Data source: NIPA (compensation) | BLS Productivity Data
#' @export
#' @examples
@@ 29,6 29,7 @@ get_productivity_and_hourly_compensation <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
M R/union.r => R/union.r +2 -2
@@ 4,7 4,7 @@
#' bargaining agreement.
#'
#' @return \code{tbl_df}
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @note Data source: CPS ORG | Hirsch and Macpherson (2003)
#' @export
#' @examples
@@ 16,7 16,7 @@ get_union_coverage <- function() {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
- cols <- stringi::stri_replace_all_regex(cols, "[\\(\\)]", "")
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
M R/utils.r => R/utils.r +7 -1
@@ 10,7 10,7 @@ make_params <- function(params, by, ok="") {
}
-clean_cols <- function(x) {
+.clean_cols <- function(x) {
x <- stringi::stri_replace_all_fixed(x, ",", "")
@@ 23,3 23,9 @@ clean_cols <- function(x) {
}
}
+
+clean_cols <- function(x) {
+ suppressWarnings(
+ .clean_cols(x)
+ )
+}<
\ No newline at end of file
M R/wage_decomposition.r => R/wage_decomposition.r +2 -1
@@ 9,7 9,7 @@
#'
#' @param by \code{NULL} or character string of \code{g} (Gender)
#' @return \code{tbl_df} with data filtered by the selected criteria.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @note Data source: CPS ORG
#' @export
#' @examples
@@ 27,6 27,7 @@ get_wage_decomposition <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
M R/wages.r => R/wages.r +4 -3
@@ 10,7 10,7 @@
#' i.e. if you want to wage data by gender and race, you would set this
#' parameter to "\code{gr}".
#' @return \code{tbl_df} with data filtered by the selected criteria.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @export
#' @examples
#' get_median_and_mean_wages()
@@ 30,6 30,7 @@ get_median_and_mean_wages <- function(by=NULL) {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
@@ 55,7 56,7 @@ get_median_and_mean_wages <- function(by=NULL) {
#' \code{r} (Race), i.e. if you want to retrieve
#' unemployment data by gender and race, you would set this parameter to "\code{gr}".
#' @return \code{tbl_df} with data filtered by the selected criteria.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @export
#' @examples
#' get_wages_by_education()
@@ 99,7 100,7 @@ get_wages_by_education <- function(by=NULL) {
#' \code{r} (Race), i.e. if you want to retrieve
#' unemployment data by gender and race, you would set this parameter to "\code{gr}".
#' @return \code{tbl_df} with data filtered by the selected criteria.
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @export
#' @examples
#' get_wages_by_percentile()
M R/wages_and_hours.r => R/wages_and_hours.r +2 -2
@@ 6,7 6,7 @@
#' hourly wage.
#'
#' @return \code{tbl_df}
-#' @references \href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+#' @references \href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
#' @note CPS ASEC | Murphy and Welch (1989)
#' @export
#' @examples
@@ 18,7 18,7 @@ get_annual_wages_and_work_hours <- function() {
res <- epi_query(params)
cols <- stringi::stri_trans_tolower(res$columns$name)
- cols <- stringi::stri_replace_all_regex(cols, "[\\(\\)]", "")
+ cols <- stringi::stri_replace_all_regex(cols, "[\\('\\)]", "")
cols <- stringi::stri_replace_all_regex(cols, "[[:space:]" %s+%
rawToChar(as.raw(c(0xe2, 0x80, 0x93))) %s+% "-]+",
"_")
M README.Rmd => README.Rmd +19 -24
@@ 20,35 20,30 @@ The [Economic Policy Institute](http://www.epi.org/data/) provides researchers,
The following functions are implemented:
-- `get_annual_wages_and_work_hours`: Retreive CPS ASEC Annual Wages and Work Hours
-- `get_black_white_wage_gap`: Retreive the percent by which hourly wages of black workers
- are less than hourly wages of white workers
-- `get_college_wage_premium`: Retreive the percent by which hourly wages of college graduates
- exceed those of otherwise equivalent high school graduates
-- `get_employment_to_population_ratio`: Retreive the share of the civilian noninstitutional
- population that is employed
-- `get_gender_wage_gap`: Retreive the percent by which hourly wages of female workers are
- less than hourly wages of male workers
-- `get_health_insurance_coverage`: Retreive Health Insurance Coverage
-- `get_hispanic_white_wage_gap`: Retreive the percent by which hourly wages of Hispanic
- workers are less than hourly wages of white workers
-- `get_labor_force_participation_rate`: Retreive the share of the civilian noninstitutional
- population that is in the labor force
-- `get_long_term_unemployment`: Retreive the share of the labor force that has been unemployed
- for six months or longer
+- `get_annual_wages_and_work_hours`: Retreive CPS ASEC Annual Wages and Work Hours
+- `get_annual_wages_by_wage_group`: Annual wages by wage group
+- `get_black_white_wage_gap`: Retreive the percent by which hourly wages of black workers are less than hourly wages of white workers
+- `get_college_wage_premium`: Retreive the percent by which hourly wages of college graduates exceed those of otherwise equivalent high school graduates
+- `get_compensation_wages_and_benefits`: Compensation, wages, and benefits
+- `get_employment_to_population_ratio`: Retreive the share of the civilian noninstitutional population that is employed
+- `get_gender_wage_gap`: Retreive the percent by which hourly wages of female workers are less than hourly wages of male workers
+- `get_health_insurance_coverage`: Retreive Health Insurance Coverage
+- `get_hispanic_white_wage_gap`: Retreive the percent by which hourly wages of Hispanic workers are less than hourly wages of white workers
+- `get_labor_force_participation_rate`: Retreive the share of the civilian noninstitutional population that is in the labor force
+- `get_long_term_unemployment`: Retreive the share of the labor force that has been unemployed for six months or longer
- `get_median_and_mean_wages`: Retreive the hourly wage in the middle of the wage distribution
-- `get_pension_coverage`: Retreive Pension Coverage
-- `get_non_high_school_wage_penalty`: Retreive the percent by which hourly wages of workers
- without a high school diploma (or equivalent) are less than wages of otherwise equivalent
- workers who have graduated from high school
+- `get_minimum_wage`: Minimum wage
+- `get_non_high_school_wage_penalty`: Retreive the percent by which hourly wages of workers without a high school diploma (or equivalent) are less than wages of otherwise equivalent workers who have graduated from high school
+- `get_pension_coverage`: Retreive Pension Coverage
+- `get_poverty_level_wages`: Poverty-level wages
+- `get_productivity_and_hourly_compensation`: Retreive Productivity and hourly compensation
- `get_underemployment`: Retreive the share of the labor force that is "underemployed"
- `get_unemployment`: Retreive the share of the labor force without a job
- `get_unemployment_by_state`: Retreive the share of the labor force without a job (by state)
-- `get_union_coverage`: Retreive Union Coverage
-- `get_wages_by_education`: Retreive the average hourly wages of workers disaggregated by the
- highest level of education attained
+- `get_union_coverage`: Retreive Union Coverage
+- `get_wages_by_education`: Retreive the average hourly wages of workers disaggregated by the highest level of education attained
- `get_wages_by_percentile`: Retreive wages at ten distinct points in the wage distribution
-- `get_wage_decomposition`: Retreive Wage Decomposition
+- `get_wage_decomposition`: Retreive Wage Decomposition
- `get_wage_ratios`: Retreive the level of inequality within the hourly wage distribution.
## Installation
M README.md => README.md +54 -47
@@ 21,11 21,14 @@ The following functions are implemented:
- `get_annual_wages_and_work_hours`: Retreive CPS ASEC Annual Wages
and Work Hours
+ - `get_annual_wages_by_wage_group`: Annual wages by wage group
- `get_black_white_wage_gap`: Retreive the percent by which hourly
wages of black workers are less than hourly wages of white workers
- `get_college_wage_premium`: Retreive the percent by which hourly
wages of college graduates exceed those of otherwise equivalent high
school graduates
+ - `get_compensation_wages_and_benefits`: Compensation, wages, and
+ benefits
- `get_employment_to_population_ratio`: Retreive the share of the
civilian noninstitutional population that is employed
- `get_gender_wage_gap`: Retreive the percent by which hourly wages of
@@ 40,11 43,15 @@ The following functions are implemented:
that has been unemployed for six months or longer
- `get_median_and_mean_wages`: Retreive the hourly wage in the middle
of the wage distribution
- - `get_pension_coverage`: Retreive Pension Coverage
+ - `get_minimum_wage`: Minimum wage
- `get_non_high_school_wage_penalty`: Retreive the percent by which
hourly wages of workers without a high school diploma (or
equivalent) are less than wages of otherwise equivalent workers who
have graduated from high school
+ - `get_pension_coverage`: Retreive Pension Coverage
+ - `get_poverty_level_wages`: Poverty-level wages
+ - `get_productivity_and_hourly_compensation`: Retreive Productivity
+ and hourly compensation
- `get_underemployment`: Retreive the share of the labor force that is
“underemployed”
- `get_unemployment`: Retreive the share of the labor force without a
@@ 75,64 82,64 @@ library(epidata)
packageVersion("epidata")
```
- ## [1] '0.2.0'
+ ## [1] '0.3.0'
``` r
get_black_white_wage_gap()
```
- ## # A tibble: 45 x 8
+ ## # A tibble: 46 x 8
## date white_median white_average black_median black_average gap_median gap_average gap_regression_based
- ## <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
- ## 1 1973 17.8 20.4 14.1 16.0 0.211 0.213 0.114
- ## 2 1974 17.4 19.9 13.8 15.7 0.204 0.211 0.103
- ## 3 1975 17.3 20.0 14.0 15.8 0.187 0.211 0.100
- ## 4 1976 17.3 20.0 13.9 16.3 0.195 0.188 0.0850
- ## 5 1977 17.5 20.1 14.0 16.2 0.195 0.195 0.0890
- ## 6 1978 17.3 20.1 13.8 16.3 0.200 0.191 0.0880
- ## 7 1979 17.5 20.3 14.3 16.6 0.180 0.181 0.0860
- ## 8 1980 17.2 19.9 14.0 16.3 0.185 0.182 0.0890
- ## 9 1981 16.8 19.7 13.8 16.2 0.178 0.181 0.0830
- ## 10 1982 17.0 19.9 13.6 16.0 0.200 0.198 0.100
- ## # ... with 35 more rows
+ ## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
+ ## 1 1973 17.6 20.4 13.7 16.0 0.223 0.215 NA
+ ## 2 1974 17.2 19.9 13.8 15.8 0.198 0.209 NA
+ ## 3 1975 17.1 20 13.9 15.8 0.191 0.208 NA
+ ## 4 1976 17.2 20.1 14.0 16.5 0.19 0.182 NA
+ ## 5 1977 17.2 20.1 13.9 16.2 0.188 0.19 NA
+ ## 6 1978 17.4 20.1 13.9 16.4 0.201 0.186 NA
+ ## 7 1979 17.1 20.3 14.3 16.8 0.164 0.173 0.086
+ ## 8 1980 17.1 19.9 14.1 16.4 0.173 0.174 0.086
+ ## 9 1981 16.7 19.8 13.8 16.4 0.175 0.174 0.0820
+ ## 10 1982 16.9 20.0 13.7 16.2 0.194 0.191 0.099
+ ## # … with 36 more rows
``` r
get_underemployment()
```
## # A tibble: 325 x 2
- ## date all
- ## <date> <dbl>
- ## 1 1989-12-01 0.0930
- ## 2 1990-01-01 0.0930
- ## 3 1990-02-01 0.0930
- ## 4 1990-03-01 0.0940
- ## 5 1990-04-01 0.0940
- ## 6 1990-05-01 0.0940
- ## 7 1990-06-01 0.0940
- ## 8 1990-07-01 0.0940
- ## 9 1990-08-01 0.0950
- ## 10 1990-09-01 0.0950
- ## # ... with 315 more rows
+ ## date all
+ ## <date> <dbl>
+ ## 1 1989-12-01 0.093
+ ## 2 1990-01-01 0.093
+ ## 3 1990-02-01 0.093
+ ## 4 1990-03-01 0.094
+ ## 5 1990-04-01 0.094
+ ## 6 1990-05-01 0.094
+ ## 7 1990-06-01 0.094
+ ## 8 1990-07-01 0.094
+ ## 9 1990-08-01 0.095
+ ## 10 1990-09-01 0.095
+ ## # … with 315 more rows
``` r
get_median_and_mean_wages("gr")
```
- ## # A tibble: 45 x 25
+ ## # A tibble: 46 x 25
## date median average men_median men_average women_median women_average white_median white_average black_median
- ## <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
- ## 1 1973 17.2 19.8 20.6 23.1 12.9 14.8 17.8 20.4 14.1
- ## 2 1974 16.8 19.4 20.3 22.7 12.9 14.6 17.4 19.9 13.8
- ## 3 1975 16.7 19.4 20.5 22.7 13.0 14.7 17.3 20.0 14.0
- ## 4 1976 16.7 19.5 20.1 22.8 13.0 15.0 17.3 20.0 13.9
- ## 5 1977 16.8 19.5 20.7 23.0 13.0 14.9 17.5 20.1 14.0
- ## 6 1978 16.9 19.5 20.7 22.9 13.0 14.9 17.3 20.1 13.8
- ## 7 1979 16.7 19.7 21.0 23.2 13.1 15.1 17.5 20.3 14.3
- ## 8 1980 16.6 19.3 20.7 22.8 13.0 15.0 17.2 19.9 14.0
- ## 9 1981 16.2 19.1 20.2 22.6 13.0 14.9 16.8 19.7 13.8
- ## 10 1982 16.3 19.3 20.0 22.7 13.0 15.2 17.0 19.9 13.6
- ## # ... with 35 more rows, and 15 more variables: black_average <dbl>, hispanic_median <dbl>, hispanic_average <dbl>,
+ ## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
+ ## 1 1973 17.0 19.7 20.6 23.1 13.0 14.9 17.6 20.4 13.7
+ ## 2 1974 16.6 19.4 20.3 22.7 12.8 14.6 17.2 19.9 13.8
+ ## 3 1975 16.6 19.4 20.7 22.7 12.9 14.8 17.1 20 13.9
+ ## 4 1976 16.6 19.6 20.3 22.9 13.1 15.1 17.2 20.1 14.0
+ ## 5 1977 16.6 19.5 20.5 22.9 13.0 15.0 17.2 20.1 13.9
+ ## 6 1978 16.8 19.6 20.8 23.0 13.0 15.0 17.4 20.1 13.9
+ ## 7 1979 16.5 19.7 20.7 23.2 13.1 15.2 17.1 20.3 14.3
+ ## 8 1980 16.4 19.4 20.5 22.8 13.1 15.1 17.1 19.9 14.1
+ ## 9 1981 16.2 19.2 20.1 22.6 13.1 15.1 16.7 19.8 13.8
+ ## 10 1982 16.1 19.4 20.1 22.8 13.0 15.3 16.9 20.0 13.7
+ ## # … with 36 more rows, and 15 more variables: black_average <dbl>, hispanic_median <dbl>, hispanic_average <dbl>,
## # white_men_median <dbl>, white_men_average <dbl>, black_men_median <dbl>, black_men_average <dbl>,
## # hispanic_men_median <dbl>, hispanic_men_average <dbl>, white_women_median <dbl>, white_women_average <dbl>,
## # black_women_median <dbl>, black_women_average <dbl>, hispanic_women_median <dbl>, hispanic_women_average <dbl>
@@ 151,11 158,11 @@ wages <- get_median_and_mean_wages()
glimpse(wages)
```
- ## Observations: 45
+ ## Observations: 46
## Variables: 3
- ## $ date <int> 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 198...
- ## $ median <dbl> 17.16, 16.78, 16.73, 16.70, 16.76, 16.92, 16.71, 16.63, 16.18, 16.28, 16.26, 16.24, 16.34, 16.81, 1...
- ## $ average <dbl> 19.75, 19.36, 19.39, 19.51, 19.52, 19.47, 19.72, 19.31, 19.14, 19.29, 19.31, 19.38, 19.61, 20.06, 2...
+ ## $ date <dbl> 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989,…
+ ## $ median <dbl> 16.96, 16.63, 16.64, 16.60, 16.62, 16.77, 16.49, 16.38, 16.21, 16.14, 16.17, 16.26, 16.51, 16.62, 16.…
+ ## $ average <dbl> 19.73, 19.37, 19.41, 19.63, 19.53, 19.57, 19.74, 19.35, 19.24, 19.41, 19.45, 19.52, 19.73, 20.20, 20.…
``` r
glimpse(unemployment)
@@ 163,8 170,8 @@ glimpse(unemployment)
## Observations: 457
## Variables: 2
- ## $ date <date> 1978-12-01, 1979-01-01, 1979-02-01, 1979-03-01, 1979-04-01, 1979-05-01, 1979-06-01, 1979-07-01, 1979-...
- ## $ all <dbl> 0.061, 0.061, 0.060, 0.060, 0.059, 0.059, 0.059, 0.058, 0.058, 0.058, 0.059, 0.059, 0.059, 0.059, 0.05...
+ ## $ date <date> 1978-12-01, 1979-01-01, 1979-02-01, 1979-03-01, 1979-04-01, 1979-05-01, 1979-06-01, 1979-07-01, 1979-08…
+ ## $ all <dbl> 0.061, 0.061, 0.060, 0.060, 0.059, 0.059, 0.059, 0.058, 0.058, 0.058, 0.059, 0.059, 0.059, 0.059, 0.059,…
``` r
group_by(unemployment, date=as.integer(lubridate::year(date))) %>%
M README_files/figure-gfm/unnamed-chunk-4-1.png => README_files/figure-gfm/unnamed-chunk-4-1.png +0 -0
M man/epidata.Rd => man/epidata.Rd +1 -0
@@ 15,3 15,4 @@ demographic groups. Data is usually updated monthly.
\author{
Bob Rudis (bob@rud.is)
}
+\keyword{internal}
M man/get_annual_wages_and_work_hours.Rd => man/get_annual_wages_and_work_hours.Rd +1 -1
@@ 22,5 22,5 @@ CPS ASEC | Murphy and Welch (1989)
get_annual_wages_and_work_hours()
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
A man/get_annual_wages_by_wage_group.Rd => man/get_annual_wages_by_wage_group.Rd +42 -0
@@ 0,0 1,42 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/annual-wages-by-wage-group.R
+\name{get_annual_wages_by_wage_group}
+\alias{get_annual_wages_by_wage_group}
+\title{Annual wages by wage group}
+\usage{
+get_annual_wages_by_wage_group()
+}
+\value{
+\code{tbl_df} with data filtered by the selected criteria.
+}
+\description{
+Return the average annual salaries for select wage groups, with particular focus on
+the highest wage earners. Note that this data is not directly comparable to wage
+deciles/percentiles.
+}
+\details{
+Wages are in 2017 dollars. Population sample: All workers.
+
+The average annual wages by wage group are taken from a 2010 article by Wojciech Kopczuk,
+Emmanuel Saez, and Jae Song. To extend this series, data for 2006 through 2017 are
+extrapolated from 2004 data using changes in wage shares computed from Social Security
+Administration wage statistics. We employ the midpoint of the bracket to compute total
+wage income in each bracket and sum all brackets. We then use interpolation to derive
+percentile cutoffs building from the bottom up to obtain the 0–90th percentile bracket
+and then estimate the remaining categories. This allows us to estimate the wage shares
+for upper wage groups. We use these wage shares computed for 2004 and later years to
+extend the Kopczuk, Saez, and Song series by adding the changes in share between 2004
+and the relevant year to their series. To obtain absolute wage trends we use the SSA data
+on the total wage pool and employment and compute the real wage per worker (based on t
+heir share of wages and employment) in the different groups in 2017 dollars. For a
+detailed explanation, see the methodology for annual wages and hours.
+}
+\note{
+Data source: SSA | Kopczuk, Saez, and Song (2010)
+}
+\examples{
+get_annual_wages_by_wage_group()
+}
+\references{
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
+}
M man/get_black_white_wage_gap.Rd => man/get_black_white_wage_gap.Rd +1 -1
@@ 35,5 35,5 @@ get_black_white_wage_gap()
get_black_white_wage_gap("g")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M man/get_college_wage_premium.Rd => man/get_college_wage_premium.Rd +1 -1
@@ 25,5 25,5 @@ get_college_wage_premium()
get_college_wage_premium("g")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
A man/get_compensation_wages_and_benefits.Rd => man/get_compensation_wages_and_benefits.Rd +28 -0
@@ 0,0 1,28 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/compensation-wages-benefits.R
+\name{get_compensation_wages_and_benefits}
+\alias{get_compensation_wages_and_benefits}
+\title{Compensation, wages, and benefits}
+\usage{
+get_compensation_wages_and_benefits()
+}
+\value{
+\code{tbl_df} with data filtered by the selected criteria.
+}
+\description{
+Return the nonwage payments, referred to as fringe benefits, and wages.
+Compensation includes employer payments for health insurance, pensions,
+and payroll taxes (primarily payments toward Social Security and unemployment insurance).
+}
+\details{
+Wages are in 2016 dollars. Wage and salary workers (NIPA) | Private-sector workers (ECEC)
+}
+\note{
+Data source: NIPA | ECEC
+}
+\examples{
+get_compensation_wages_and_benefits()
+}
+\references{
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
+}
M man/get_employment_to_population_ratio.Rd => man/get_employment_to_population_ratio.Rd +1 -1
@@ 25,5 25,5 @@ get_employment_to_population_ratio("r")
get_employment_to_population_ratio("grae")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M man/get_gender_wage_gap.Rd => man/get_gender_wage_gap.Rd +1 -1
@@ 34,5 34,5 @@ get_gender_wage_gap()
get_gender_wage_gap("r")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M man/get_health_insurance_coverage.Rd => man/get_health_insurance_coverage.Rd +1 -1
@@ 34,5 34,5 @@ get_health_insurance_coverage("r")
get_health_insurance_coverage("gr")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M man/get_hispanic_white_wage_gap.Rd => man/get_hispanic_white_wage_gap.Rd +1 -1
@@ 35,5 35,5 @@ get_hispanic_white_wage_gap()
get_hispanic_white_wage_gap("g")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M man/get_labor_force_participation_rate.Rd => man/get_labor_force_participation_rate.Rd +1 -1
@@ 25,5 25,5 @@ get_labor_force_participation_rate("r")
get_labor_force_participation_rate("grae")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M man/get_long_term_unemployment.Rd => man/get_long_term_unemployment.Rd +1 -1
@@ 25,5 25,5 @@ get_long_term_unemployment("r")
get_long_term_unemployment("grae")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M man/get_median_and_mean_wages.Rd => man/get_median_and_mean_wages.Rd +1 -1
@@ 29,5 29,5 @@ get_median_and_mean_wages("r")
get_median_and_mean_wages("gr")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
A man/get_minimum_wage.Rd => man/get_minimum_wage.Rd +31 -0
@@ 0,0 1,31 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/minimum-wage.R
+\name{get_minimum_wage}
+\alias{get_minimum_wage}
+\title{Minimum wage}
+\usage{
+get_minimum_wage()
+}
+\value{
+\code{tbl_df} with data filtered by the selected criteria.
+}
+\description{
+Return tthe hourly minimum wage set by federal law. The real minimum wage is the federal
+hourly minimum wage adjusted for inflation.
+}
+\details{
+Wages are in 2016 dollars, excluding the nominal federal minimum wage. Share of average
+wages based on the average wages of production and nonsupervisory workers. For state
+minimum wages, see EPI’s minimum wage tracker.
+
+Population sample: Production and nonsupervisory workers (average wages)
+}
+\note{
+Data source: U.S. Department of Labor Wage and Hour Division | CES
+}
+\examples{
+get_minimum_wage()
+}
+\references{
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
+}
M man/get_non_high_school_wage_penalty.Rd => man/get_non_high_school_wage_penalty.Rd +1 -1
@@ 28,5 28,5 @@ get_non_high_school_wage_penalty("g")
}
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M man/get_pension_coverage.Rd => man/get_pension_coverage.Rd +1 -1
@@ 34,5 34,5 @@ get_health_insurance_coverage("r")
get_health_insurance_coverage("gr")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
A man/get_poverty_level_wages.Rd => man/get_poverty_level_wages.Rd +37 -0
@@ 0,0 1,37 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/poverty.R
+\name{get_poverty_level_wages}
+\alias{get_poverty_level_wages}
+\title{Poverty-level wages}
+\usage{
+get_poverty_level_wages(by = NULL)
+}
+\arguments{
+\item{by}{\code{NULL} or character string with any combination of \code{g} (Gender) or
+\code{r} (Race), i.e. if you want to retrieve
+unemployment data by gender and race, you would set this parameter to "\code{gr}".}
+}
+\value{
+\code{tbl_df} with data filtered by the selected criteria.
+}
+\description{
+Return the share of workers earning equal to or less than the poverty-level wage, or
+the hourly wage that a full-time, year-round worker must earn to sustain a family of
+four with two children at the official poverty threshold.
+}
+\details{
+Population sample: Wage and salary workers age 18–64. Data source: CPS ORG | Census
+Bureau (poverty threshold)
+}
+\examples{
+\dontrun{
+get_poverty_level_wages()
+
+get_poverty_level_wages("r")
+
+get_poverty_level_wages("gr")
+}
+}
+\references{
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
+}
M man/get_productivity_and_hourly_compensation.Rd => man/get_productivity_and_hourly_compensation.Rd +1 -1
@@ 32,5 32,5 @@ get_productivity_and_hourly_compensation()
get_productivity_and_hourly_compensation("g")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M man/get_underemployment.Rd => man/get_underemployment.Rd +1 -1
@@ 29,5 29,5 @@ get_underemployment("r")
get_underemployment("grae")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M man/get_unemployment.Rd => man/get_unemployment.Rd +1 -1
@@ 28,5 28,5 @@ get_unemployment("r")
get_unemployment("grae")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M man/get_unemployment_by_state.Rd => man/get_unemployment_by_state.Rd +1 -1
@@ 24,5 24,5 @@ get_unemployment_by_state()
get_unemployment_by_state("r")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M man/get_union_coverage.Rd => man/get_union_coverage.Rd +1 -1
@@ 20,5 20,5 @@ Data source: CPS ORG | Hirsch and Macpherson (2003)
get_union_coverage()
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M man/get_wage_decomposition.Rd => man/get_wage_decomposition.Rd +1 -1
@@ 30,5 30,5 @@ get_wages_by_percentile()
get_wages_by_percentile("g")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M man/get_wage_ratios.Rd => man/get_wage_ratios.Rd +1 -1
@@ 37,5 37,5 @@ get_wage_ratios("gr")
}
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M man/get_wages_by_education.Rd => man/get_wages_by_education.Rd +1 -1
@@ 28,5 28,5 @@ get_wages_by_education("r")
get_wages_by_education("gr")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M man/get_wages_by_percentile.Rd => man/get_wages_by_percentile.Rd +1 -1
@@ 27,5 27,5 @@ get_wages_by_percentile("r")
get_wages_by_percentile("gr")
}
\references{
-\href{http://www.epi.org/data/}{Economic Policy Institute Data Library}
+\href{https://www.epi.org/data/}{Economic Policy Institute Data Library}
}
M tests/testthat/test-epidata.R => tests/testthat/test-epidata.R +6 -2
@@ 1,11 1,13 @@
-context("basic functionality")
-test_that("we can do something", {
+context("API endpoints")
+test_that("All API endpoints work as expected", {
testthat::skip_on_cran()
expect_that(get_annual_wages_and_work_hours(), is_a("data.frame"))
+ expect_that(get_annual_wages_by_wage_group(), is_a("data.frame"))
expect_that(get_black_white_wage_gap(), is_a("data.frame"))
expect_that(get_college_wage_premium(), is_a("data.frame"))
+ expect_that(get_compensation_wages_and_benefits(), is_a("data.frame"))
expect_that(get_employment_to_population_ratio(), is_a("data.frame"))
expect_that(get_gender_wage_gap(), is_a("data.frame"))
expect_that(get_health_insurance_coverage(), is_a("data.frame"))
@@ 13,8 15,10 @@ test_that("we can do something", {
expect_that(get_labor_force_participation_rate(), is_a("data.frame"))
expect_that(get_long_term_unemployment(), is_a("data.frame"))
expect_that(get_median_and_mean_wages(), is_a("data.frame"))
+ expect_that(get_minimum_wage(), is_a("data.frame"))
expect_that(get_non_high_school_wage_penalty(), is_a("data.frame"))
expect_that(get_pension_coverage(), is_a("data.frame"))
+ expect_that(get_poverty_level_wages(), is_a("data.frame"))
expect_that(get_productivity_and_hourly_compensation(), is_a("data.frame"))
expect_that(get_underemployment(), is_a("data.frame"))
expect_that(get_unemployment(), is_a("data.frame"))