Skip to content

Commit

Permalink
create csv versions of important tabs, for archive purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
benzipperer committed Jan 23, 2024
1 parent 23155c9 commit 52cebb3
Show file tree
Hide file tree
Showing 31 changed files with 943 additions and 339 deletions.
33 changes: 26 additions & 7 deletions R/clean_owe_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,31 @@ calculate_owe <- function(.data, x) {
# emp_b^2 / wage_b^2 * (emp_se^2 / emp_b^2 + wage_se^2 / wage_b^2)
}

# grab papers
make_bib <- function(owe_sheet, data_version) {
download_sheet <- function(google_sheet, tab_name, csv_name, data_version, ...) {
gs4_deauth()
read_sheet(owe_sheet, "papers") %>%

if (tab_name == "detailed_calculations") {
data <- read_sheet(
google_sheet,
tab_name,
col_names = FALSE,
col_types = "c",
.name_repair = "unique_quiet"
)
}

else {
data <- read_sheet(google_sheet, tab_name)
}

write_csv(data, csv_name)

csv_name
}

# grab papers
make_bib <- function(papers_csv) {
read_csv(papers_csv, show_col_types = FALSE) %>%
select(
study_id, matches("author_"), year,
title, journal, volume, number, pages, url, country
Expand Down Expand Up @@ -82,10 +103,8 @@ make_bib_csv <- function(bib_data) {
file
}

make_owe_data <- function(owe_sheet, bib_data, data_version) {
gs4_deauth()

read_sheet(owe_sheet, "estimates") %>%
make_owe_data <- function(estimates_csv, bib_data, data_version) {
read_csv(estimates_csv, show_col_types = FALSE) %>%
# calculate new owe
calculate_owe(owe_new) %>%
# if owe b or se was originally missing, use new calculated owe
Expand Down
2 changes: 1 addition & 1 deletion _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project:
resources: mw_owe_database.csv, mw_owe_studies.csv, mw_owe_studies.bib

website:
title: "OWE database"
title: "OWE repository"
repo-url: https://github.com/economic/owe
search: false
navbar:
Expand Down
30 changes: 26 additions & 4 deletions _targets.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source("packages.R")
## Globals
citation_authors <- "Arindrajit Dube and Ben Zipperer"
citation_year <- 2024
citation_title <- "Minimum wage own-wage elasticity database"
citation_title <- "Minimum wage own-wage elasticity repository"
citation_url <- "https://economic.github.io/owe"
data_version <- "0.10.0"
owe_sheet <- "1-uBymldLhp5IsG-qiRmUGDy883ij8vjYdx6YpbHAing"
Expand All @@ -20,15 +20,37 @@ tar_plan(
citation_url,
data_version
),

# csv versions of the key google sheets
tar_file(
sheet_papers_csv,
download_sheet(owe_sheet, "papers", "sheet_papers.csv", data_version)
),
tar_file(
sheet_estimates_csv,
download_sheet(owe_sheet, "estimates", "sheet_estimates.csv", data_version)
),
tar_file(
sheet_calculations_csv,
download_sheet(
owe_sheet,
"detailed_calculations",
"sheet_calculations.csv",
data_version
)
),

# cleaned bib and owe data
bib_data = make_bib(sheet_papers_csv),
owe_data = make_owe_data(sheet_estimates_csv, bib_data, data_version),

bib_data = make_bib(owe_sheet, data_version),
owe_data = make_owe_data(owe_sheet, bib_data, data_version),

# output files
tar_file(bib_bibtex_file, make_bib_bibtex(bib_data)),
tar_file(bib_csv_file, make_bib_csv(bib_data)),
tar_file(owe_csv_file, make_owe_csv(owe_data)),
tar_file(owe_csv_tidy_file, make_owe_csv_tidy(owe_data)),

# website
tar_quarto(website, execute_params = list(data_version = data_version))
)

Expand Down
64 changes: 31 additions & 33 deletions docs/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.4.489">
<meta name="generator" content="quarto-1.4.544">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">


<title>OWE database - Documentation</title>
<title>OWE repository - Documentation</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
Expand Down Expand Up @@ -44,6 +44,7 @@
"search-more-match-text": "more match in this document",
"search-more-matches-text": "more matches in this document",
"search-clear-button-title": "Clear",
"search-text-placeholder": "",
"search-detached-cancel-button-title": "Cancel",
"search-submit-button-title": "Submit",
"search-label": "Search"
Expand All @@ -61,7 +62,7 @@
<div class="navbar-container container-fluid">
<div class="navbar-brand-container mx-auto">
<a class="navbar-brand" href="./index.html">
<span class="navbar-title">OWE database</span>
<span class="navbar-title">OWE repository</span>
</a>
</div>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
Expand Down Expand Up @@ -135,13 +136,13 @@ <h1 class="title">Documentation</h1>


<p>The own-wage elasticity (OWE) of employment is an estimate of the employment change for a given wage change experienced by a group of workers, where in this case the changes in wages and employment are due to minimum wage increases.</p>
<p>The <strong>Minimum Wage Own-Wage Elasticity Database</strong>, contains a representative estimate of the OWE of employment from every minimum wage study published since 1992, with the following restrictions:</p>
<p>The <strong>Minimum Wage Own-Wage Elasticity Repository</strong>, contains a representative estimate of the OWE of employment from every minimum wage study published since 1992, with the following restrictions:</p>
<ol type="1">
<li><p>the study must estimate a statistically significant wage effect of the policy, in addition to estimating an employment effect</p></li>
<li><p>studies not published in a peer-reviewed journal or equivalent are omitted if they are more than 10 years old</p></li>
<li><p>the study must focus on the US, UK, Germany, or Canada (we will eventually relax this constraint!)</p></li>
</ol>
<p>The current version of the database, Version 0.10.0, contains 76 studies, 64 of which are published in peer-reviewed journals. Version 1.0 of the database is described in IMAGE AND LINK TO WORKING PAPER.</p>
<p>The current version of the repository, Version 0.10.0, contains 76 studies, 64 of which are published in peer-reviewed journals. Version 1.0 of the repository is described in IMAGE AND LINK TO WORKING PAPER.</p>
<p>For more information, explore a <a href="table.html">table</a> of all the studies or download the underlying <a href="download.html">data</a>. Please don’t hesitate to <a href="submit.html">submit</a> any corrections or studies we have accidentally omitted.</p>
<p>If you use the data or this site in your own work, please reference or cite it:</p>
<div class="callout callout-style-default callout-note callout-titled">
Expand All @@ -154,7 +155,7 @@ <h1 class="title">Documentation</h1>
</div>
</div>
<div class="callout-body-container callout-body">
<p>Arindrajit Dube and Ben Zipperer. 2024. <em>Minimum wage own-wage elasticity database</em>, Version 0.10.0. <a href="https://economic.github.io/owe" class="uri">https://economic.github.io/owe</a></p>
<p>Arindrajit Dube and Ben Zipperer. 2024. <em>Minimum wage own-wage elasticity repository</em>, Version 0.10.0. <a href="https://economic.github.io/owe" class="uri">https://economic.github.io/owe</a></p>
</div>
</div>

Expand Down Expand Up @@ -289,38 +290,28 @@ <h1 class="title">Documentation</h1>
}
}
stripColumnClz(note)
const typesetMath = (el) => {
if (window.MathJax) {
// MathJax Typeset
window.MathJax.typeset([el]);
} else if (window.katex) {
// KaTeX Render
var mathElements = el.getElementsByClassName("math");
var macros = [];
for (var i = 0; i < mathElements.length; i++) {
var texText = mathElements[i].firstChild;
if (mathElements[i].tagName == "SPAN") {
window.katex.render(texText.data, mathElements[i], {
displayMode: mathElements[i].classList.contains('display'),
throwOnError: false,
macros: macros,
fleqn: false
});
}
}
}
}
if (id === null || id.startsWith('sec-')) {
// Special case sections, only their first couple elements
const container = document.createElement("div");
if (note.children && note.children.length > 2) {
for (let i = 0; i < 2; i++) {
container.appendChild(note.children[i].cloneNode(true));
container.appendChild(note.children[0].cloneNode(true));
for (let i = 1; i < note.children.length; i++) {
const child = note.children[i];
if (child.tagName === "P" && child.innerText === "") {
continue;
} else {
container.appendChild(child.cloneNode(true));
break;
}
}
if (window.Quarto?.typesetMath) {
window.Quarto.typesetMath(container);
}
typesetMath(container);
return container.innerHTML
} else {
typesetMath(note);
if (window.Quarto?.typesetMath) {
window.Quarto.typesetMath(note);
}
return note.innerHTML;
}
} else {
Expand All @@ -329,8 +320,15 @@ <h1 class="title">Documentation</h1>
if (anchorLink) {
anchorLink.remove();
}
typesetMath(note);
return note.innerHTML;
if (window.Quarto?.typesetMath) {
window.Quarto.typesetMath(note);
}
// TODO in 1.5, we should make sure this works without a callout special case
if (note.classList.contains("callout")) {
return note.outerHTML;
} else {
return note.innerHTML;
}
}
}
for (var i=0; i<xrefs.length; i++) {
Expand Down
68 changes: 33 additions & 35 deletions docs/download.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.4.489">
<meta name="generator" content="quarto-1.4.544">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">


<title>OWE database - Data files</title>
<title>OWE repository - Data files</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
Expand Down Expand Up @@ -44,6 +44,7 @@
"search-more-match-text": "more match in this document",
"search-more-matches-text": "more matches in this document",
"search-clear-button-title": "Clear",
"search-text-placeholder": "",
"search-detached-cancel-button-title": "Cancel",
"search-submit-button-title": "Submit",
"search-label": "Search"
Expand All @@ -68,7 +69,7 @@
<div class="navbar-container container-fluid">
<div class="navbar-brand-container mx-auto">
<a class="navbar-brand" href="./index.html">
<span class="navbar-title">OWE database</span>
<span class="navbar-title">OWE repository</span>
</a>
</div>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
Expand Down Expand Up @@ -141,13 +142,13 @@ <h1 class="title">Data files</h1>
</header>


<section id="owe-database" class="level2">
<h2 class="anchored" data-anchor-id="owe-database">OWE database</h2>
<section id="owe-repository" class="level2">
<h2 class="anchored" data-anchor-id="owe-repository">OWE repository</h2>
<p>Download the latest version of the data: <a href="mw_owe_database.csv">csv</a></p>
<div class="cell">
<div class="cell-output-display">
<div class="reactable html-widget html-fill-item" id="database_columns" style="width:auto;height:auto;"></div>
<script type="application/json" data-for="database_columns">{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Column name":["study","study_id","owe_b","owe_se","owe_lb","owe_ub","owe_magnitude","group","overall","teens","restaurants_retail","country","averaged","owe_reported","published","authors","year","title","journal","url","source","data_version"],"Column description":["Study name, as author-year","Study name, abbreviated","Effect size","Standard error","Lower bound of 95% confidence interval","Upper bound of 95% confidence interval","Qualitative description of magnitude of owe_b","Group of workers","Covers a very broad group of low-wage workers","Estimate focused on teens","Estimate focused on restaurants or retail","Country","Multiple estimates from the study were averaged","Authors report own-wage elasticities","Published in a peer-review journal or equivalent","Full names of authors","Year of study","Title of study","Journal","URL of study","Description of how the OWE was calculated","Minimum wage OWE database version"]},"columns":[{"id":"Column name","name":"Column name","type":"character"},{"id":"Column description","name":"Column description","type":"character"}],"pagination":false,"elementId":"database_columns","dataKey":"9f58e6ba80d9e4b58fa57f2742fcfebb"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}</script>
<div class="reactable html-widget html-fill-item" id="repository_columns" style="width:auto;height:auto;"></div>
<script type="application/json" data-for="repository_columns">{"x":{"tag":{"name":"Reactable","attribs":{"data":{"Column name":["study","study_id","owe_b","owe_se","owe_lb","owe_ub","owe_magnitude","group","overall","teens","restaurants_retail","country","averaged","owe_reported","published","authors","year","title","journal","url","source","data_version"],"Column description":["Study name, as author-year","Study name, abbreviated","Effect size","Standard error","Lower bound of 95% confidence interval","Upper bound of 95% confidence interval","Qualitative description of magnitude of owe_b","Group of workers","Covers a very broad group of low-wage workers","Estimate focused on teens","Estimate focused on restaurants or retail","Country","Multiple estimates from the study were averaged","Authors report own-wage elasticities","Published in a peer-review journal or equivalent","Full names of authors","Year of study","Title of study","Journal","URL of study","Description of how the OWE was calculated","Minimum wage OWE repository version"]},"columns":[{"id":"Column name","name":"Column name","type":"character"},{"id":"Column description","name":"Column description","type":"character"}],"pagination":false,"elementId":"repository_columns","dataKey":"47d8f1bcddaff026c008275df8e0dc84"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}</script>
</div>
</div>
<p><br> See the <a href="documentation.html">documentation</a> for additional details.</p>
Expand All @@ -169,7 +170,7 @@ <h2 class="anchored" data-anchor-id="citation-and-use-of-the-data">Citation and
</div>
</div>
<div class="callout-body-container callout-body">
<p>Arindrajit Dube and Ben Zipperer. 2024. <em>Minimum wage own-wage elasticity database</em>, Version 0.10.0. <a href="https://economic.github.io/owe" class="uri">https://economic.github.io/owe</a></p>
<p>Arindrajit Dube and Ben Zipperer. 2024. <em>Minimum wage own-wage elasticity repository</em>, Version 0.10.0. <a href="https://economic.github.io/owe" class="uri">https://economic.github.io/owe</a></p>
</div>
</div>
</section>
Expand Down Expand Up @@ -309,38 +310,28 @@ <h2 class="anchored" data-anchor-id="older-versions-of-the-data">Older versions
}
}
stripColumnClz(note)
const typesetMath = (el) => {
if (window.MathJax) {
// MathJax Typeset
window.MathJax.typeset([el]);
} else if (window.katex) {
// KaTeX Render
var mathElements = el.getElementsByClassName("math");
var macros = [];
for (var i = 0; i < mathElements.length; i++) {
var texText = mathElements[i].firstChild;
if (mathElements[i].tagName == "SPAN") {
window.katex.render(texText.data, mathElements[i], {
displayMode: mathElements[i].classList.contains('display'),
throwOnError: false,
macros: macros,
fleqn: false
});
}
}
}
}
if (id === null || id.startsWith('sec-')) {
// Special case sections, only their first couple elements
const container = document.createElement("div");
if (note.children && note.children.length > 2) {
for (let i = 0; i < 2; i++) {
container.appendChild(note.children[i].cloneNode(true));
container.appendChild(note.children[0].cloneNode(true));
for (let i = 1; i < note.children.length; i++) {
const child = note.children[i];
if (child.tagName === "P" && child.innerText === "") {
continue;
} else {
container.appendChild(child.cloneNode(true));
break;
}
}
if (window.Quarto?.typesetMath) {
window.Quarto.typesetMath(container);
}
typesetMath(container);
return container.innerHTML
} else {
typesetMath(note);
if (window.Quarto?.typesetMath) {
window.Quarto.typesetMath(note);
}
return note.innerHTML;
}
} else {
Expand All @@ -349,8 +340,15 @@ <h2 class="anchored" data-anchor-id="older-versions-of-the-data">Older versions
if (anchorLink) {
anchorLink.remove();
}
typesetMath(note);
return note.innerHTML;
if (window.Quarto?.typesetMath) {
window.Quarto.typesetMath(note);
}
// TODO in 1.5, we should make sure this works without a callout special case
if (note.classList.contains("callout")) {
return note.outerHTML;
} else {
return note.innerHTML;
}
}
}
for (var i=0; i<xrefs.length; i++) {
Expand Down
Loading

0 comments on commit 52cebb3

Please sign in to comment.