new post and rerender
451
_site/blog.html
|
@ -2,7 +2,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.3.450">
|
||||
<meta name="generator" content="quarto-1.4.553">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
|
@ -47,7 +47,13 @@ ul.task-list li input[type="checkbox"] {
|
|||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 20,
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
|
@ -56,6 +62,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
"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"
|
||||
|
@ -94,16 +101,43 @@ ul.task-list li input[type="checkbox"] {
|
|||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
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
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
window.Quarto = {
|
||||
typesetMath
|
||||
};
|
||||
</script>
|
||||
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
|
||||
<body class="nav-fixed">
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||||
<header id="quarto-header" class="headroom fixed-top quarto-banner">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="./index.html">
|
||||
<span class="navbar-title">Kyle Belanger</span>
|
||||
</a>
|
||||
|
@ -115,22 +149,22 @@ ul.task-list li input[type="checkbox"] {
|
|||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="./blog.html" rel="" target="" aria-current="page">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
<a class="nav-link active" href="./blog.html" aria-current="page">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="./kyle_resume.pdf" rel="" target="">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
<a class="nav-link" href="./kyle_resume.pdf">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
</li>
|
||||
<li class="nav-item compact">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19" rel="" target=""><i class="bi bi-github" role="img">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19"> <i class="bi bi-github" role="img">
|
||||
</i>
|
||||
<span class="menu-text"></span></a>
|
||||
<span class="menu-text"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
|
@ -143,7 +177,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
</div>
|
||||
|
||||
|
||||
<div class="quarto-title-meta">
|
||||
<div class="quarto-title-meta column-page-left">
|
||||
|
||||
|
||||
|
||||
|
@ -156,7 +190,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
<!-- margin-sidebar -->
|
||||
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
|
||||
|
||||
<h5 class="quarto-listing-category-title">Categories</h5><div class="quarto-listing-category category-default"><div class="category" data-category="">All <span class="quarto-category-count">(10)</span></div><div class="category" data-category="Distill">Distill <span class="quarto-category-count">(1)</span></div><div class="category" data-category="TidyTuesday">TidyTuesday <span class="quarto-category-count">(1)</span></div></div></div>
|
||||
<h5 class="quarto-listing-category-title">Categories</h5><div class="quarto-listing-category category-default"><div class="category" data-category="">All <span class="quarto-category-count">(11)</span></div><div class="category" data-category="Distill">Distill <span class="quarto-category-count">(1)</span></div><div class="category" data-category="R">R <span class="quarto-category-count">(1)</span></div><div class="category" data-category="TidyTuesday">TidyTuesday <span class="quarto-category-count">(1)</span></div><div class="category" data-category="dataViz">dataViz <span class="quarto-category-count">(1)</span></div><div class="category" data-category="tidytuesday">tidytuesday <span class="quarto-category-count">(1)</span></div></div></div>
|
||||
<!-- main -->
|
||||
<main class="content quarto-banner-title-block column-page-left" id="quarto-document-content">
|
||||
|
||||
|
@ -167,27 +201,67 @@ ul.task-list li input[type="checkbox"] {
|
|||
|
||||
|
||||
|
||||
|
||||
<div class="quarto-listing quarto-listing-container-default" id="listing-listing">
|
||||
<div class="list quarto-listing-default">
|
||||
<div class="quarto-post image-right" data-index="0" data-listing-date-sort="1697083200000" data-listing-file-modified-sort="1697123995301" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="3">
|
||||
<div class="quarto-post image-right" data-index="0" data-categories="tidytuesday,R,dataViz" data-listing-date-sort="1717819200000" data-listing-file-modified-sort="1717849238082" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="4" data-listing-word-count-sort="605">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2023-10-12_DHSC_Capstone/index.html"> <div class="listing-item-img-placeholder card-img-top" > </div> </a></p>
|
||||
<p><a href="./posts/2024-05-15-US-NHL-Birthrate/index.html" class="no-external"></a></p><a href="./posts/2024-05-15-US-NHL-Birthrate/index.html" class="no-external">
|
||||
<p class="card-img-top"><img src="posts\2024-05-15-US-NHL-Birthrate\index_files\figure-html\Graph_It-1.png" class="thumbnail-image card-img"/></p>
|
||||
</a><p><a href="./posts/2024-05-15-US-NHL-Birthrate/index.html" class="no-external"></a></p>
|
||||
</div>
|
||||
<div class="body">
|
||||
<a href="./posts/2023-10-12_DHSC_Capstone/index.html">
|
||||
<h3 class="no-anchor listing-title">
|
||||
Reflex Testing using Machine Learning in the Clinical Laboratory
|
||||
<a href="./posts/2024-05-15-US-NHL-Birthrate/index.html" class="no-external">Does a US Born Players Birthdate affect their shot at the NHL</a>
|
||||
</h3>
|
||||
<div class="listing-subtitle">
|
||||
<p>This post contains the abstract of my Capstone for the Doctorate of Health Science program at Campbell University.</p>
|
||||
<a href="./posts/2024-05-15-US-NHL-Birthrate/index.html" class="no-external"></a>
|
||||
</div>
|
||||
<div class="listing-categories">
|
||||
<div class="listing-category" onclick="window.quartoListingCategory('tidytuesday'); return false;">
|
||||
tidytuesday
|
||||
</div>
|
||||
<div class="listing-category" onclick="window.quartoListingCategory('R'); return false;">
|
||||
R
|
||||
</div>
|
||||
<div class="listing-category" onclick="window.quartoListingCategory('dataViz'); return false;">
|
||||
dataViz
|
||||
</div>
|
||||
</div>
|
||||
<div class="listing-description">
|
||||
To view the full paper please go to the following link
|
||||
<a href="./posts/2024-05-15-US-NHL-Birthrate/index.html" class="no-external">Inspired by TidyTuesday Week 2 - 2024 dataset about Candian Players, lets look at the same anaylyis for American Born Players</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<a href="./posts/2024-05-15-US-NHL-Birthrate/index.html" class="no-external">
|
||||
<div class="listing-date">
|
||||
Jun 8, 2024
|
||||
</div>
|
||||
<div class="listing-author">
|
||||
Kyle Belanger
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="1" data-listing-date-sort="1697083200000" data-listing-file-modified-sort="1715274259534" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="3" data-listing-word-count-sort="458">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2023-10-12_DHSC_Capstone/index.html" class="no-external"></a></p><a href="./posts/2023-10-12_DHSC_Capstone/index.html" class="no-external">
|
||||
<div class="listing-item-img-placeholder card-img-top" > </div>
|
||||
</a><p><a href="./posts/2023-10-12_DHSC_Capstone/index.html" class="no-external"></a></p>
|
||||
</div>
|
||||
<div class="body">
|
||||
<h3 class="no-anchor listing-title">
|
||||
<a href="./posts/2023-10-12_DHSC_Capstone/index.html" class="no-external">Reflex Testing using Machine Learning in the Clinical Laboratory</a>
|
||||
</h3>
|
||||
<div class="listing-subtitle">
|
||||
<a href="./posts/2023-10-12_DHSC_Capstone/index.html" class="no-external">This post contains the abstract of my Capstone for the Doctorate of Health Science program at Campbell University. </a>
|
||||
</div>
|
||||
<div class="listing-description">
|
||||
<a href="./posts/2023-10-12_DHSC_Capstone/index.html" class="no-external">To view the full paper please go to the following link</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<a href="./posts/2023-10-12_DHSC_Capstone/index.html">
|
||||
<a href="./posts/2023-10-12_DHSC_Capstone/index.html" class="no-external">
|
||||
<div class="listing-date">
|
||||
Oct 12, 2023
|
||||
</div>
|
||||
|
@ -197,32 +271,30 @@ Kyle Belanger
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="1" data-categories="TidyTuesday" data-listing-date-sort="1614315600000" data-listing-file-modified-sort="1697115484734" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="12">
|
||||
<div class="quarto-post image-right" data-index="2" data-categories="TidyTuesday" data-listing-date-sort="1614315600000" data-listing-file-modified-sort="1715274259533" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="12" data-listing-word-count-sort="2346">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2021-02-26_tidytuesday-hbcu-enrollment/tidytuesday-2021-week-6-hbcu-enrolment.html"> <p class="card-img-top"><img src="posts\2021-02-26_tidytuesday-hbcu-enrollment\tidytuesday-2021-week-6-hbcu-enrolment_files\figure-html\unnamed-chunk-10-1.png" class="thumbnail-image card-img"/></p> </a></p>
|
||||
<p><a href="./posts/2021-02-26_tidytuesday-hbcu-enrollment/tidytuesday-2021-week-6-hbcu-enrolment.html" class="no-external"></a></p><a href="./posts/2021-02-26_tidytuesday-hbcu-enrollment/tidytuesday-2021-week-6-hbcu-enrolment.html" class="no-external">
|
||||
<p class="card-img-top"><img src="posts\2021-02-26_tidytuesday-hbcu-enrollment\tidytuesday-2021-week-6-hbcu-enrolment_files\figure-html\unnamed-chunk-10-1.png" class="thumbnail-image card-img"/></p>
|
||||
</a><p><a href="./posts/2021-02-26_tidytuesday-hbcu-enrollment/tidytuesday-2021-week-6-hbcu-enrolment.html" class="no-external"></a></p>
|
||||
</div>
|
||||
<div class="body">
|
||||
<a href="./posts/2021-02-26_tidytuesday-hbcu-enrollment/tidytuesday-2021-week-6-hbcu-enrolment.html">
|
||||
<h3 class="no-anchor listing-title">
|
||||
TidyTuesday 2021 Week 6: HBCU Enrollment
|
||||
<a href="./posts/2021-02-26_tidytuesday-hbcu-enrollment/tidytuesday-2021-week-6-hbcu-enrolment.html" class="no-external">TidyTuesday 2021 Week 6: HBCU Enrollment</a>
|
||||
</h3>
|
||||
<div class="listing-subtitle">
|
||||
<p>TidyTuesday 2021 Week 6: HBCU Enrollment. Posts looks at tidying the data ,as well as making some graphs about the data.</p>
|
||||
<a href="./posts/2021-02-26_tidytuesday-hbcu-enrollment/tidytuesday-2021-week-6-hbcu-enrolment.html" class="no-external">TidyTuesday 2021 Week 6: HBCU Enrollment. Posts looks at tidying the data ,as well as making some graphs about the data. </a>
|
||||
</div>
|
||||
</a>
|
||||
<div class="listing-categories">
|
||||
<div class="listing-category" onclick="window.quartoListingCategory('TidyTuesday'); return false;">
|
||||
TidyTuesday
|
||||
</div>
|
||||
</div>
|
||||
<a href="./posts/2021-02-26_tidytuesday-hbcu-enrollment/tidytuesday-2021-week-6-hbcu-enrolment.html">
|
||||
<div class="listing-description">
|
||||
Recently I was struggling to find a data project to work on, I felt a bit stuck with some of my current projects, so I begun to scour the internet to find something to work…
|
||||
<a href="./posts/2021-02-26_tidytuesday-hbcu-enrollment/tidytuesday-2021-week-6-hbcu-enrolment.html" class="no-external">Recently I was struggling to find a data project to work on, I felt a bit stuck with some of my current projects, so I begun to scour the internet to find something to work…</a>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<a href="./posts/2021-02-26_tidytuesday-hbcu-enrollment/tidytuesday-2021-week-6-hbcu-enrolment.html">
|
||||
<a href="./posts/2021-02-26_tidytuesday-hbcu-enrollment/tidytuesday-2021-week-6-hbcu-enrolment.html" class="no-external">
|
||||
<div class="listing-date">
|
||||
Feb 26, 2021
|
||||
</div>
|
||||
|
@ -232,32 +304,30 @@ Kyle Belanger
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="2" data-categories="Distill" data-listing-date-sort="1610427600000" data-listing-file-modified-sort="1697116059113" data-listing-date-modified-sort="1697083200000" data-listing-reading-time-sort="3">
|
||||
<div class="quarto-post image-right" data-index="3" data-categories="Distill" data-listing-date-sort="1610427600000" data-listing-file-modified-sort="1715274259531" data-listing-date-modified-sort="1697083200000" data-listing-reading-time-sort="3" data-listing-word-count-sort="575">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2021-01-12_blogdown-to-distill/creating-a-distill-blog.html"> <div class="listing-item-img-placeholder card-img-top" > </div> </a></p>
|
||||
<p><a href="./posts/2021-01-12_blogdown-to-distill/creating-a-distill-blog.html" class="no-external"></a></p><a href="./posts/2021-01-12_blogdown-to-distill/creating-a-distill-blog.html" class="no-external">
|
||||
<div class="listing-item-img-placeholder card-img-top" > </div>
|
||||
</a><p><a href="./posts/2021-01-12_blogdown-to-distill/creating-a-distill-blog.html" class="no-external"></a></p>
|
||||
</div>
|
||||
<div class="body">
|
||||
<a href="./posts/2021-01-12_blogdown-to-distill/creating-a-distill-blog.html">
|
||||
<h3 class="no-anchor listing-title">
|
||||
Converting From Blogdown to Distill
|
||||
<a href="./posts/2021-01-12_blogdown-to-distill/creating-a-distill-blog.html" class="no-external">Converting From Blogdown to Distill</a>
|
||||
</h3>
|
||||
<div class="listing-subtitle">
|
||||
<p>A meta post on transferring from a blogdown to distill blog site</p>
|
||||
<a href="./posts/2021-01-12_blogdown-to-distill/creating-a-distill-blog.html" class="no-external">A meta post on transferring from a blogdown to distill blog site </a>
|
||||
</div>
|
||||
</a>
|
||||
<div class="listing-categories">
|
||||
<div class="listing-category" onclick="window.quartoListingCategory('Distill'); return false;">
|
||||
Distill
|
||||
</div>
|
||||
</div>
|
||||
<a href="./posts/2021-01-12_blogdown-to-distill/creating-a-distill-blog.html">
|
||||
<div class="listing-description">
|
||||
I have since converted this blog to a quarto blog, but am leaving this post up in case anyone finds it useful
|
||||
<a href="./posts/2021-01-12_blogdown-to-distill/creating-a-distill-blog.html" class="no-external">I have since converted this blog to a quarto blog, but am leaving this post up in case anyone finds it useful</a>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<a href="./posts/2021-01-12_blogdown-to-distill/creating-a-distill-blog.html">
|
||||
<a href="./posts/2021-01-12_blogdown-to-distill/creating-a-distill-blog.html" class="no-external">
|
||||
<div class="listing-date">
|
||||
Jan 12, 2021
|
||||
</div>
|
||||
|
@ -267,25 +337,25 @@ Kyle Belanger
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="3" data-listing-date-sort="1595649600000" data-listing-file-modified-sort="1697114923312" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="4">
|
||||
<div class="quarto-post image-right" data-index="4" data-listing-date-sort="1595649600000" data-listing-file-modified-sort="1715274259530" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="4" data-listing-word-count-sort="722">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2020-07-25_diabetes-data-collection-and-cleaning/diabetes-in-rural-north-carolina-data-collection-and-cleaning.html"> <p class="card-img-top"><img src="posts\2020-07-25_diabetes-data-collection-and-cleaning\data-cleaning.png" class="thumbnail-image card-img"/></p> </a></p>
|
||||
<p><a href="./posts/2020-07-25_diabetes-data-collection-and-cleaning/diabetes-in-rural-north-carolina-data-collection-and-cleaning.html" class="no-external"></a></p><a href="./posts/2020-07-25_diabetes-data-collection-and-cleaning/diabetes-in-rural-north-carolina-data-collection-and-cleaning.html" class="no-external">
|
||||
<p class="card-img-top"><img src="posts\2020-07-25_diabetes-data-collection-and-cleaning\data-cleaning.png" class="thumbnail-image card-img"/></p>
|
||||
</a><p><a href="./posts/2020-07-25_diabetes-data-collection-and-cleaning/diabetes-in-rural-north-carolina-data-collection-and-cleaning.html" class="no-external"></a></p>
|
||||
</div>
|
||||
<div class="body">
|
||||
<a href="./posts/2020-07-25_diabetes-data-collection-and-cleaning/diabetes-in-rural-north-carolina-data-collection-and-cleaning.html">
|
||||
<h3 class="no-anchor listing-title">
|
||||
Diabetes in Rural North Carolina : Data Collection and Cleaning
|
||||
<a href="./posts/2020-07-25_diabetes-data-collection-and-cleaning/diabetes-in-rural-north-carolina-data-collection-and-cleaning.html" class="no-external">Diabetes in Rural North Carolina : Data Collection and Cleaning</a>
|
||||
</h3>
|
||||
<div class="listing-subtitle">
|
||||
<p>This is the second post in the series exploring Diabetes in rural North Carolina. This post will explore the data used for this project, from collection, cleaning, and analysis ready data.</p>
|
||||
<a href="./posts/2020-07-25_diabetes-data-collection-and-cleaning/diabetes-in-rural-north-carolina-data-collection-and-cleaning.html" class="no-external">This is the second post in the series exploring Diabetes in rural North Carolina. This post will explore the data used for this project, from collection, cleaning, and analysis ready data. </a>
|
||||
</div>
|
||||
<div class="listing-description">
|
||||
This is the…
|
||||
<a href="./posts/2020-07-25_diabetes-data-collection-and-cleaning/diabetes-in-rural-north-carolina-data-collection-and-cleaning.html" class="no-external">This is the second post in the series exploring Diabetes in rural North Carolina. This post will explore the data used for this project, from collection, cleaning, and…</a>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<a href="./posts/2020-07-25_diabetes-data-collection-and-cleaning/diabetes-in-rural-north-carolina-data-collection-and-cleaning.html">
|
||||
<a href="./posts/2020-07-25_diabetes-data-collection-and-cleaning/diabetes-in-rural-north-carolina-data-collection-and-cleaning.html" class="no-external">
|
||||
<div class="listing-date">
|
||||
Jul 25, 2020
|
||||
</div>
|
||||
|
@ -295,25 +365,25 @@ Kyle Belanger
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="4" data-listing-date-sort="1593057600000" data-listing-file-modified-sort="1697120858345" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="8">
|
||||
<div class="quarto-post image-right" data-index="5" data-listing-date-sort="1593057600000" data-listing-file-modified-sort="1715274259526" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="8" data-listing-word-count-sort="1512">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2020-06-25_diabetes-prevalence-in-nc/diabetes-in-rural-north-carolina-exploring-prevalence-trends.html"> <p class="card-img-top"><img src="posts\2020-06-25_diabetes-prevalence-in-nc\diabetes-in-rural-north-carolina-exploring-prevalence-trends_files\figure-html\o-g1-1.png" class="thumbnail-image card-img"/></p> </a></p>
|
||||
<p><a href="./posts/2020-06-25_diabetes-prevalence-in-nc/diabetes-in-rural-north-carolina-exploring-prevalence-trends.html" class="no-external"></a></p><a href="./posts/2020-06-25_diabetes-prevalence-in-nc/diabetes-in-rural-north-carolina-exploring-prevalence-trends.html" class="no-external">
|
||||
<p class="card-img-top"><img src="posts\2020-06-25_diabetes-prevalence-in-nc\diabetes-in-rural-north-carolina-exploring-prevalence-trends_files\figure-html\o-g1-1.png" class="thumbnail-image card-img"/></p>
|
||||
</a><p><a href="./posts/2020-06-25_diabetes-prevalence-in-nc/diabetes-in-rural-north-carolina-exploring-prevalence-trends.html" class="no-external"></a></p>
|
||||
</div>
|
||||
<div class="body">
|
||||
<a href="./posts/2020-06-25_diabetes-prevalence-in-nc/diabetes-in-rural-north-carolina-exploring-prevalence-trends.html">
|
||||
<h3 class="no-anchor listing-title">
|
||||
Diabetes in Rural North Carolina : Exploring Prevalence Trends
|
||||
<a href="./posts/2020-06-25_diabetes-prevalence-in-nc/diabetes-in-rural-north-carolina-exploring-prevalence-trends.html" class="no-external">Diabetes in Rural North Carolina : Exploring Prevalence Trends</a>
|
||||
</h3>
|
||||
<div class="listing-subtitle">
|
||||
<p>This post introduces the exploration of the Diabetes epidemic in North Carolina</p>
|
||||
<a href="./posts/2020-06-25_diabetes-prevalence-in-nc/diabetes-in-rural-north-carolina-exploring-prevalence-trends.html" class="no-external">This post introduces the exploration of the Diabetes epidemic in North Carolina </a>
|
||||
</div>
|
||||
<div class="listing-description">
|
||||
2022-15-03: Since this was…
|
||||
<a href="./posts/2020-06-25_diabetes-prevalence-in-nc/diabetes-in-rural-north-carolina-exploring-prevalence-trends.html" class="no-external">2022-15-03: Since this was posted the CDC has updated how county level diabetes prevalance is calculated. The data presented here is using previous calcualtions and may no…</a>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<a href="./posts/2020-06-25_diabetes-prevalence-in-nc/diabetes-in-rural-north-carolina-exploring-prevalence-trends.html">
|
||||
<a href="./posts/2020-06-25_diabetes-prevalence-in-nc/diabetes-in-rural-north-carolina-exploring-prevalence-trends.html" class="no-external">
|
||||
<div class="listing-date">
|
||||
Jun 25, 2020
|
||||
</div>
|
||||
|
@ -323,25 +393,25 @@ Kyle Belanger
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="5" data-listing-date-sort="1592798400000" data-listing-file-modified-sort="1697115048321" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="3">
|
||||
<div class="quarto-post image-right" data-index="6" data-listing-date-sort="1592798400000" data-listing-file-modified-sort="1715274259523" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="3" data-listing-word-count-sort="534">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2020-06-22_excel-data-multiple-headers/importing-excel-data-with-multiple-header-rows.html"> <p class="card-img-top"><img src="posts\2020-06-22_excel-data-multiple-headers\example_data_img1.png" alt="image of example data" class="thumbnail-image card-img"/></p> </a></p>
|
||||
<p><a href="./posts/2020-06-22_excel-data-multiple-headers/importing-excel-data-with-multiple-header-rows.html" class="no-external"></a></p><a href="./posts/2020-06-22_excel-data-multiple-headers/importing-excel-data-with-multiple-header-rows.html" class="no-external">
|
||||
<p class="card-img-top"><img src="posts\2020-06-22_excel-data-multiple-headers\example_data_img1.png" alt="image of example data" class="thumbnail-image card-img"/></p>
|
||||
</a><p><a href="./posts/2020-06-22_excel-data-multiple-headers/importing-excel-data-with-multiple-header-rows.html" class="no-external"></a></p>
|
||||
</div>
|
||||
<div class="body">
|
||||
<a href="./posts/2020-06-22_excel-data-multiple-headers/importing-excel-data-with-multiple-header-rows.html">
|
||||
<h3 class="no-anchor listing-title">
|
||||
Importing Excel Data with Multiple Header Rows
|
||||
<a href="./posts/2020-06-22_excel-data-multiple-headers/importing-excel-data-with-multiple-header-rows.html" class="no-external">Importing Excel Data with Multiple Header Rows</a>
|
||||
</h3>
|
||||
<div class="listing-subtitle">
|
||||
<p>A solution for importing Excel Data that contains two header rows.</p>
|
||||
<a href="./posts/2020-06-22_excel-data-multiple-headers/importing-excel-data-with-multiple-header-rows.html" class="no-external">A solution for importing Excel Data that contains two header rows. </a>
|
||||
</div>
|
||||
<div class="listing-description">
|
||||
Recently I tried to important some Microsoft Excel data into R, and ran into an issue were the data actually had two different header rows. The top row listed a group, and…
|
||||
<a href="./posts/2020-06-22_excel-data-multiple-headers/importing-excel-data-with-multiple-header-rows.html" class="no-external">Recently I tried to important some Microsoft Excel data into R, and ran into an issue were the data actually had two different header rows. The top row listed a group, and…</a>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<a href="./posts/2020-06-22_excel-data-multiple-headers/importing-excel-data-with-multiple-header-rows.html">
|
||||
<a href="./posts/2020-06-22_excel-data-multiple-headers/importing-excel-data-with-multiple-header-rows.html" class="no-external">
|
||||
<div class="listing-date">
|
||||
Jun 22, 2020
|
||||
</div>
|
||||
|
@ -351,25 +421,25 @@ Kyle Belanger
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="6" data-listing-date-sort="1581570000000" data-listing-file-modified-sort="1697056704620" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="11">
|
||||
<div class="quarto-post image-right" data-index="7" data-listing-date-sort="1581570000000" data-listing-file-modified-sort="1715274259519" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="11" data-listing-word-count-sort="2089">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2020-02-13_basic-who-TB-data/basic-exploration-of-who-tuberculosis-data.html"> <p class="card-img-top"><img src="posts\2020-02-13_basic-who-TB-data\basic-exploration-of-who-tuberculosis-data_files\figure-html\unnamed-chunk-5-1.png" class="thumbnail-image card-img"/></p> </a></p>
|
||||
<p><a href="./posts/2020-02-13_basic-who-TB-data/basic-exploration-of-who-tuberculosis-data.html" class="no-external"></a></p><a href="./posts/2020-02-13_basic-who-TB-data/basic-exploration-of-who-tuberculosis-data.html" class="no-external">
|
||||
<p class="card-img-top"><img src="posts\2020-02-13_basic-who-TB-data\basic-exploration-of-who-tuberculosis-data_files\figure-html\unnamed-chunk-5-1.png" class="thumbnail-image card-img"/></p>
|
||||
</a><p><a href="./posts/2020-02-13_basic-who-TB-data/basic-exploration-of-who-tuberculosis-data.html" class="no-external"></a></p>
|
||||
</div>
|
||||
<div class="body">
|
||||
<a href="./posts/2020-02-13_basic-who-TB-data/basic-exploration-of-who-tuberculosis-data.html">
|
||||
<h3 class="no-anchor listing-title">
|
||||
Basic Exploration of WHO Tuberculosis Data
|
||||
<a href="./posts/2020-02-13_basic-who-TB-data/basic-exploration-of-who-tuberculosis-data.html" class="no-external">Basic Exploration of WHO Tuberculosis Data</a>
|
||||
</h3>
|
||||
<div class="listing-subtitle">
|
||||
<p>Today I am going to dive into some real life data from the World Health Organization (WHO), exploring new and relapse cases of Tuberculosis. I clean up the data, and then make a few graphs to explore different variables.</p>
|
||||
<a href="./posts/2020-02-13_basic-who-TB-data/basic-exploration-of-who-tuberculosis-data.html" class="no-external">Today I am going to dive into some real life data from the World Health Organization (WHO), exploring new and relapse cases of Tuberculosis. I clean up the data, and then make a few graphs to explore different variables. </a>
|
||||
</div>
|
||||
<div class="listing-description">
|
||||
Today I am going to dive into some real…
|
||||
<a href="./posts/2020-02-13_basic-who-TB-data/basic-exploration-of-who-tuberculosis-data.html" class="no-external">Today I am going to dive into some real life data from the World Health Organization (WHO), exploring new and relapse cases of Tuberculosis. I clean up the data, and then…</a>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<a href="./posts/2020-02-13_basic-who-TB-data/basic-exploration-of-who-tuberculosis-data.html">
|
||||
<a href="./posts/2020-02-13_basic-who-TB-data/basic-exploration-of-who-tuberculosis-data.html" class="no-external">
|
||||
<div class="listing-date">
|
||||
Feb 13, 2020
|
||||
</div>
|
||||
|
@ -379,25 +449,25 @@ Kyle Belanger
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="7" data-listing-date-sort="1581310800000" data-listing-file-modified-sort="1697114568395" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="8">
|
||||
<div class="quarto-post image-right" data-index="8" data-listing-date-sort="1581310800000" data-listing-file-modified-sort="1715274259501" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="8" data-listing-word-count-sort="1470">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2020-02-10_line-graphs-and-interactivity/line-graphs-and-interactivity.html"> <p class="card-img-top"><img src="posts\2020-02-10_line-graphs-and-interactivity\flu_surveillance.png" alt="Example Line Graph" class="thumbnail-image card-img"/></p> </a></p>
|
||||
<p><a href="./posts/2020-02-10_line-graphs-and-interactivity/line-graphs-and-interactivity.html" class="no-external"></a></p><a href="./posts/2020-02-10_line-graphs-and-interactivity/line-graphs-and-interactivity.html" class="no-external">
|
||||
<p class="card-img-top"><img src="posts\2020-02-10_line-graphs-and-interactivity\flu_surveillance.png" alt="Example Line Graph" class="thumbnail-image card-img"/></p>
|
||||
</a><p><a href="./posts/2020-02-10_line-graphs-and-interactivity/line-graphs-and-interactivity.html" class="no-external"></a></p>
|
||||
</div>
|
||||
<div class="body">
|
||||
<a href="./posts/2020-02-10_line-graphs-and-interactivity/line-graphs-and-interactivity.html">
|
||||
<h3 class="no-anchor listing-title">
|
||||
Line Graphs and Interactivity
|
||||
<a href="./posts/2020-02-10_line-graphs-and-interactivity/line-graphs-and-interactivity.html" class="no-external">Line Graphs and Interactivity</a>
|
||||
</h3>
|
||||
<div class="listing-subtitle">
|
||||
<p>Tableau for Healthcare Chapter 10. Static and Interactive examples</p>
|
||||
<a href="./posts/2020-02-10_line-graphs-and-interactivity/line-graphs-and-interactivity.html" class="no-external">Tableau for Healthcare Chapter 10. Static and Interactive examples </a>
|
||||
</div>
|
||||
<div class="listing-description">
|
||||
Today’s post is all about line graphs using both ggplot…
|
||||
<a href="./posts/2020-02-10_line-graphs-and-interactivity/line-graphs-and-interactivity.html" class="no-external">Today’s post is all about line graphs using both ggplot for a static graph as well as a package called plotly for interactivity (more on this later). The example graph and…</a>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<a href="./posts/2020-02-10_line-graphs-and-interactivity/line-graphs-and-interactivity.html">
|
||||
<a href="./posts/2020-02-10_line-graphs-and-interactivity/line-graphs-and-interactivity.html" class="no-external">
|
||||
<div class="listing-date">
|
||||
Feb 10, 2020
|
||||
</div>
|
||||
|
@ -407,25 +477,25 @@ Kyle Belanger
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="8" data-listing-date-sort="1580274000000" data-listing-file-modified-sort="1697114439706" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="3">
|
||||
<div class="quarto-post image-right" data-index="9" data-listing-date-sort="1580274000000" data-listing-file-modified-sort="1715274259493" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="3" data-listing-word-count-sort="574">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2020-01-29_facets-and-humility/facets-and-a-lesson-in-humility.html"> <p class="card-img-top"><img src="posts\2020-01-29_facets-and-humility\WHO_LIFE.png" class="thumbnail-image card-img"/></p> </a></p>
|
||||
<p><a href="./posts/2020-01-29_facets-and-humility/facets-and-a-lesson-in-humility.html" class="no-external"></a></p><a href="./posts/2020-01-29_facets-and-humility/facets-and-a-lesson-in-humility.html" class="no-external">
|
||||
<p class="card-img-top"><img src="posts\2020-01-29_facets-and-humility\WHO_LIFE.png" class="thumbnail-image card-img"/></p>
|
||||
</a><p><a href="./posts/2020-01-29_facets-and-humility/facets-and-a-lesson-in-humility.html" class="no-external"></a></p>
|
||||
</div>
|
||||
<div class="body">
|
||||
<a href="./posts/2020-01-29_facets-and-humility/facets-and-a-lesson-in-humility.html">
|
||||
<h3 class="no-anchor listing-title">
|
||||
Facets and a Lesson in Humility
|
||||
<a href="./posts/2020-01-29_facets-and-humility/facets-and-a-lesson-in-humility.html" class="no-external">Facets and a Lesson in Humility</a>
|
||||
</h3>
|
||||
<div class="listing-subtitle">
|
||||
<p>A look at Tableau for Healthcare Chapter 8. Table Lens graph.</p>
|
||||
<a href="./posts/2020-01-29_facets-and-humility/facets-and-a-lesson-in-humility.html" class="no-external">A look at Tableau for Healthcare Chapter 8. Table Lens graph. </a>
|
||||
</div>
|
||||
<div class="listing-description">
|
||||
Todays post is a lesson in Facets, as well as humility. The task this week was to replicate the graph in Chapter 8 of Tableau for Healthcare in R. The graph in question is…
|
||||
<a href="./posts/2020-01-29_facets-and-humility/facets-and-a-lesson-in-humility.html" class="no-external">Todays post is a lesson in Facets, as well as humility. The task this week was to replicate the graph in Chapter 8 of Tableau for Healthcare in R. The graph in question is…</a>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<a href="./posts/2020-01-29_facets-and-humility/facets-and-a-lesson-in-humility.html">
|
||||
<a href="./posts/2020-01-29_facets-and-humility/facets-and-a-lesson-in-humility.html" class="no-external">
|
||||
<div class="listing-date">
|
||||
Jan 29, 2020
|
||||
</div>
|
||||
|
@ -435,25 +505,25 @@ Kyle Belanger
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="9" data-listing-date-sort="1579842000000" data-listing-file-modified-sort="1697052101192" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="2">
|
||||
<div class="quarto-post image-right" data-index="10" data-listing-date-sort="1579842000000" data-listing-file-modified-sort="1715274259489" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="2" data-listing-word-count-sort="356">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2020-01-04_my-start-to-r/my-start-to-r.html"> <p class="card-img-top"><img src="posts\2020-01-04_my-start-to-r\my-start-to-r_files\figure-html\unnamed-chunk-5-1.png" class="thumbnail-image card-img"/></p> </a></p>
|
||||
<p><a href="./posts/2020-01-04_my-start-to-r/my-start-to-r.html" class="no-external"></a></p><a href="./posts/2020-01-04_my-start-to-r/my-start-to-r.html" class="no-external">
|
||||
<p class="card-img-top"><img src="posts\2020-01-04_my-start-to-r\my-start-to-r_files\figure-html\unnamed-chunk-5-1.png" class="thumbnail-image card-img"/></p>
|
||||
</a><p><a href="./posts/2020-01-04_my-start-to-r/my-start-to-r.html" class="no-external"></a></p>
|
||||
</div>
|
||||
<div class="body">
|
||||
<a href="./posts/2020-01-04_my-start-to-r/my-start-to-r.html">
|
||||
<h3 class="no-anchor listing-title">
|
||||
My Start to R
|
||||
<a href="./posts/2020-01-04_my-start-to-r/my-start-to-r.html" class="no-external">My Start to R</a>
|
||||
</h3>
|
||||
<div class="listing-subtitle">
|
||||
<p>A short introduction to my blog, and R journey.</p>
|
||||
<a href="./posts/2020-01-04_my-start-to-r/my-start-to-r.html" class="no-external">A short introduction to my blog, and R journey. </a>
|
||||
</div>
|
||||
<div class="listing-description">
|
||||
Today starts my attempt at sharing my R journey with the world! I have been learning R off and on now since late 2019, I have begun to take it much more serious as I work…
|
||||
<a href="./posts/2020-01-04_my-start-to-r/my-start-to-r.html" class="no-external">Today starts my attempt at sharing my R journey with the world! I have been learning R off and on now since late 2019, I have begun to take it much more serious as I work…</a>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<a href="./posts/2020-01-04_my-start-to-r/my-start-to-r.html">
|
||||
<a href="./posts/2020-01-04_my-start-to-r/my-start-to-r.html" class="no-external">
|
||||
<div class="listing-date">
|
||||
Jan 24, 2020
|
||||
</div>
|
||||
|
@ -547,10 +617,27 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
function tippyHover(el, contentFn) {
|
||||
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||||
var mailtoRegex = new RegExp(/^mailto:/);
|
||||
var filterRegex = new RegExp('/' + window.location.host + '/');
|
||||
var isInternal = (href) => {
|
||||
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
|
||||
}
|
||||
// Inspect non-navigation links and adorn them if external
|
||||
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool)');
|
||||
for (var i=0; i<links.length; i++) {
|
||||
const link = links[i];
|
||||
if (!isInternal(link.href)) {
|
||||
// undo the damage that might have been done by quarto-nav.js in the case of
|
||||
// links that we want to consider external
|
||||
if (link.dataset.originalHref !== undefined) {
|
||||
link.href = link.dataset.originalHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
content: contentFn,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
|
@ -560,8 +647,17 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start'
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
|
@ -573,7 +669,130 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
try { href = new URL(href).hash; } catch {}
|
||||
const id = href.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
return note.innerHTML;
|
||||
if (note) {
|
||||
return note.innerHTML;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
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++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
|
@ -617,6 +836,7 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
|
@ -642,6 +862,32 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
|
@ -705,4 +951,5 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
218
_site/index.html
|
@ -2,7 +2,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.3.450">
|
||||
<meta name="generator" content="quarto-1.4.553">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
|
@ -44,7 +44,13 @@ ul.task-list li input[type="checkbox"] {
|
|||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 20,
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
|
@ -53,6 +59,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
"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"
|
||||
|
@ -67,9 +74,9 @@ ul.task-list li input[type="checkbox"] {
|
|||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="./index.html">
|
||||
<span class="navbar-title">Kyle Belanger</span>
|
||||
</a>
|
||||
|
@ -81,22 +88,22 @@ ul.task-list li input[type="checkbox"] {
|
|||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="./blog.html" rel="" target="">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
<a class="nav-link" href="./blog.html">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="./kyle_resume.pdf" rel="" target="">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
<a class="nav-link" href="./kyle_resume.pdf">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
</li>
|
||||
<li class="nav-item compact">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19" rel="" target=""><i class="bi bi-github" role="img">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19"> <i class="bi bi-github" role="img">
|
||||
</i>
|
||||
<span class="menu-text"></span></a>
|
||||
<span class="menu-text"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
|
@ -106,7 +113,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
<!-- margin-sidebar -->
|
||||
|
||||
<!-- main -->
|
||||
<div class="quarto-about-broadside column-page">
|
||||
<div class="quarto-about-broadside column-page content">
|
||||
<div class="about-main">
|
||||
<div class="about-entity" style="background-image: url('kyle.jpg')"></div>
|
||||
<div class="about-contents"><header id="title-block-header" class="quarto-title-block default">
|
||||
|
@ -224,10 +231,27 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
function tippyHover(el, contentFn) {
|
||||
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||||
var mailtoRegex = new RegExp(/^mailto:/);
|
||||
var filterRegex = new RegExp('/' + window.location.host + '/');
|
||||
var isInternal = (href) => {
|
||||
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
|
||||
}
|
||||
// Inspect non-navigation links and adorn them if external
|
||||
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool)');
|
||||
for (var i=0; i<links.length; i++) {
|
||||
const link = links[i];
|
||||
if (!isInternal(link.href)) {
|
||||
// undo the damage that might have been done by quarto-nav.js in the case of
|
||||
// links that we want to consider external
|
||||
if (link.dataset.originalHref !== undefined) {
|
||||
link.href = link.dataset.originalHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
content: contentFn,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
|
@ -237,8 +261,17 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start'
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
|
@ -250,7 +283,130 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
try { href = new URL(href).hash; } catch {}
|
||||
const id = href.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
return note.innerHTML;
|
||||
if (note) {
|
||||
return note.innerHTML;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
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++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
|
@ -294,6 +450,7 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
|
@ -319,6 +476,32 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
|
@ -382,4 +565,5 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
|
@ -2,6 +2,7 @@
|
|||
{
|
||||
"listing": "/blog.html",
|
||||
"items": [
|
||||
"/posts/2024-05-15-US-NHL-Birthrate/index.html",
|
||||
"/posts/2023-10-12_DHSC_Capstone/index.html",
|
||||
"/posts/2021-02-26_tidytuesday-hbcu-enrollment/tidytuesday-2021-week-6-hbcu-enrolment.html",
|
||||
"/posts/2021-01-12_blogdown-to-distill/creating-a-distill-blog.html",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.3.450">
|
||||
<meta name="generator" content="quarto-1.4.553">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
|
@ -24,7 +24,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
}
|
||||
/* CSS for syntax highlighting */
|
||||
pre > code.sourceCode { white-space: pre; position: relative; }
|
||||
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
|
||||
pre > code.sourceCode > span { line-height: 1.25; }
|
||||
pre > code.sourceCode > span:empty { height: 1.2em; }
|
||||
.sourceCode { overflow: visible; }
|
||||
code.sourceCode > span { color: inherit; text-decoration: inherit; }
|
||||
|
@ -81,7 +81,13 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 20,
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
|
@ -90,6 +96,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
"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"
|
||||
|
@ -103,10 +110,10 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<body class="floating nav-fixed">
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||||
<header id="quarto-header" class="headroom fixed-top quarto-banner">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="../../index.html">
|
||||
<span class="navbar-title">Kyle Belanger</span>
|
||||
</a>
|
||||
|
@ -118,22 +125,22 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../blog.html" rel="" target="">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
<a class="nav-link" href="../../blog.html">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../kyle_resume.pdf" rel="" target="">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
<a class="nav-link" href="../../kyle_resume.pdf">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
</li>
|
||||
<li class="nav-item compact">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19" rel="" target=""><i class="bi bi-github" role="img">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19"> <i class="bi bi-github" role="img">
|
||||
</i>
|
||||
<span class="menu-text"></span></a>
|
||||
<span class="menu-text"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
|
@ -169,7 +176,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
</header><div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
|
||||
<!-- sidebar -->
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation floating overflow-auto">
|
||||
<nav id="TOC" role="doc-toc" class="toc-active">
|
||||
<h2 id="toc-title">Table of contents</h2>
|
||||
|
||||
|
@ -182,7 +189,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
</ul>
|
||||
</nav>
|
||||
</nav>
|
||||
<div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
|
||||
<div id="quarto-sidebar-glass" class="quarto-sidebar-collapse-item" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item"></div>
|
||||
<!-- margin-sidebar -->
|
||||
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
|
||||
</div>
|
||||
|
@ -192,6 +199,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
|
||||
|
||||
|
||||
<p>Today starts my attempt at sharing my R journey with the world! I have been learning R off and on now since late 2019, I have begun to take it much more serious as I work through my Data Analytics class at UCF. My love for all things numbers and graphs has really blossomed, and I am choosing to share that love with anyone who cares to read. I will not claim to be the best at R, or any programming for that matter, but these are my attempts. Each post in this serious will be replicated a graph created in Tableau from the book Tableau for Healthcare. Todays graph is a simple horizontal bar chart, in transferring to both a new blog site and computer I have unfortunately lost the original bar graph, but trust me the one I created looks just like it.</p>
|
||||
<section id="load-libraries" class="level1">
|
||||
<h1>Load Libraries</h1>
|
||||
|
@ -248,14 +256,18 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<span id="cb5-13"><a href="#cb5-13" aria-hidden="true" tabindex="-1"></a> </span>
|
||||
<span id="cb5-14"><a href="#cb5-14" aria-hidden="true" tabindex="-1"></a>b1</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="my-start-to-r_files/figure-html/unnamed-chunk-5-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="my-start-to-r_files/figure-html/unnamed-chunk-5-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div id="quarto-reuse" class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</a></div></div></section><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2020,
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2020,
|
||||
author = {Belanger, Kyle},
|
||||
title = {My {Start} to {R}},
|
||||
date = {2020-01-24},
|
||||
|
@ -343,10 +355,27 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
function tippyHover(el, contentFn) {
|
||||
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||||
var mailtoRegex = new RegExp(/^mailto:/);
|
||||
var filterRegex = new RegExp('/' + window.location.host + '/');
|
||||
var isInternal = (href) => {
|
||||
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
|
||||
}
|
||||
// Inspect non-navigation links and adorn them if external
|
||||
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool)');
|
||||
for (var i=0; i<links.length; i++) {
|
||||
const link = links[i];
|
||||
if (!isInternal(link.href)) {
|
||||
// undo the damage that might have been done by quarto-nav.js in the case of
|
||||
// links that we want to consider external
|
||||
if (link.dataset.originalHref !== undefined) {
|
||||
link.href = link.dataset.originalHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
content: contentFn,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
|
@ -356,8 +385,17 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start'
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
|
@ -369,7 +407,130 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
try { href = new URL(href).hash; } catch {}
|
||||
const id = href.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
return note.innerHTML;
|
||||
if (note) {
|
||||
return note.innerHTML;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
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++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
|
@ -413,6 +574,7 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
|
@ -438,6 +600,32 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
|
@ -501,4 +689,5 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
@ -2,7 +2,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.3.450">
|
||||
<meta name="generator" content="quarto-1.4.553">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
|
@ -24,7 +24,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
}
|
||||
/* CSS for syntax highlighting */
|
||||
pre > code.sourceCode { white-space: pre; position: relative; }
|
||||
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
|
||||
pre > code.sourceCode > span { line-height: 1.25; }
|
||||
pre > code.sourceCode > span:empty { height: 1.2em; }
|
||||
.sourceCode { overflow: visible; }
|
||||
code.sourceCode > span { color: inherit; text-decoration: inherit; }
|
||||
|
@ -81,7 +81,13 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 20,
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
|
@ -90,6 +96,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
"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"
|
||||
|
@ -103,10 +110,10 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<body class="floating nav-fixed">
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||||
<header id="quarto-header" class="headroom fixed-top quarto-banner">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="../../index.html">
|
||||
<span class="navbar-title">Kyle Belanger</span>
|
||||
</a>
|
||||
|
@ -118,22 +125,22 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../blog.html" rel="" target="">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
<a class="nav-link" href="../../blog.html">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../kyle_resume.pdf" rel="" target="">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
<a class="nav-link" href="../../kyle_resume.pdf">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
</li>
|
||||
<li class="nav-item compact">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19" rel="" target=""><i class="bi bi-github" role="img">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19"> <i class="bi bi-github" role="img">
|
||||
</i>
|
||||
<span class="menu-text"></span></a>
|
||||
<span class="menu-text"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
|
@ -169,7 +176,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
</header><div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
|
||||
<!-- sidebar -->
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation floating overflow-auto">
|
||||
<nav id="TOC" role="doc-toc" class="toc-active">
|
||||
<h2 id="toc-title">Table of contents</h2>
|
||||
|
||||
|
@ -181,7 +188,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
</ul>
|
||||
</nav>
|
||||
</nav>
|
||||
<div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
|
||||
<div id="quarto-sidebar-glass" class="quarto-sidebar-collapse-item" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item"></div>
|
||||
<!-- margin-sidebar -->
|
||||
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
|
||||
</div>
|
||||
|
@ -191,6 +198,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
|
||||
|
||||
|
||||
<p>Todays post is a lesson in Facets, as well as humility. The task this week was to replicate the graph in Chapter 8 of Tableau for Healthcare in R. The graph in question is called a Table Lens (This is the name the book uses, however I did have trouble finding this name in Google searches), it is a collection of charts with a common theme, this time looking at countries in various WHO regions and some statistics associated with mortality as well as health expenditure. I say this is a lesson in humiltiy as I have read through the excellent book <a href="https://r4ds.had.co.nz/">R for Data Science</a>, and yet the idea of faceting a ggplot graph slipped my mind. This ended with hours of trying to find a package in R to line up graphs, and way more time then I care to admit spent on getting things prefect. I did find such a package called cowplots, which can be found <a href="https://wilkelab.org/cowplot/index.html">here</a>. While this is an excellent package, its use was unecessary and I reverted back to using the excellent facet feature of GGplot, which can be seen below! <img src="WHO_LIFE.png" class="img-fluid"></p>
|
||||
<section id="load-libraries" class="level1">
|
||||
<h1>Load Libraries</h1>
|
||||
|
@ -261,14 +269,18 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<span id="cb4-19"><a href="#cb4-19" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_fill_manual</span>(<span class="at">values =</span> <span class="fu">c</span>(<span class="st">"TRUE"</span> <span class="ot">=</span> <span class="st">"#fc8d59"</span>, <span class="st">"FALSE"</span> <span class="ot">=</span> <span class="st">"#2b83ba"</span>))</span>
|
||||
<span id="cb4-20"><a href="#cb4-20" aria-hidden="true" tabindex="-1"></a>g1</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="facets-and-a-lesson-in-humility_files/figure-html/unnamed-chunk-4-1.png" class="img-fluid" width="1152"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="facets-and-a-lesson-in-humility_files/figure-html/unnamed-chunk-4-1.png" class="img-fluid figure-img" width="1152"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div id="quarto-reuse" class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</a></div></div></section><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2020,
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2020,
|
||||
author = {Belanger, Kyle},
|
||||
title = {Facets and a {Lesson} in {Humility}},
|
||||
date = {2020-01-29},
|
||||
|
@ -357,10 +369,27 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
function tippyHover(el, contentFn) {
|
||||
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||||
var mailtoRegex = new RegExp(/^mailto:/);
|
||||
var filterRegex = new RegExp('/' + window.location.host + '/');
|
||||
var isInternal = (href) => {
|
||||
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
|
||||
}
|
||||
// Inspect non-navigation links and adorn them if external
|
||||
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool)');
|
||||
for (var i=0; i<links.length; i++) {
|
||||
const link = links[i];
|
||||
if (!isInternal(link.href)) {
|
||||
// undo the damage that might have been done by quarto-nav.js in the case of
|
||||
// links that we want to consider external
|
||||
if (link.dataset.originalHref !== undefined) {
|
||||
link.href = link.dataset.originalHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
content: contentFn,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
|
@ -370,8 +399,17 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start'
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
|
@ -383,7 +421,130 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
try { href = new URL(href).hash; } catch {}
|
||||
const id = href.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
return note.innerHTML;
|
||||
if (note) {
|
||||
return note.innerHTML;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
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++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
|
@ -427,6 +588,7 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
|
@ -452,6 +614,32 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
|
@ -515,4 +703,5 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
|
@ -2,7 +2,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.3.450">
|
||||
<meta name="generator" content="quarto-1.4.553">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
|
@ -24,7 +24,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
}
|
||||
/* CSS for syntax highlighting */
|
||||
pre > code.sourceCode { white-space: pre; position: relative; }
|
||||
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
|
||||
pre > code.sourceCode > span { line-height: 1.25; }
|
||||
pre > code.sourceCode > span:empty { height: 1.2em; }
|
||||
.sourceCode { overflow: visible; }
|
||||
code.sourceCode > span { color: inherit; text-decoration: inherit; }
|
||||
|
@ -81,7 +81,13 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 20,
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
|
@ -90,31 +96,42 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
"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"
|
||||
}
|
||||
}</script>
|
||||
<script src="../../site_libs/htmlwidgets-1.6.2/htmlwidgets.js"></script>
|
||||
<script src="../../site_libs/plotly-binding-4.10.2/plotly.js"></script>
|
||||
<link href="../../site_libs/htmltools-fill-0.5.8.1/fill.css" rel="stylesheet">
|
||||
|
||||
<script src="../../site_libs/htmlwidgets-1.6.4/htmlwidgets.js"></script>
|
||||
|
||||
<script src="../../site_libs/plotly-binding-4.10.4/plotly.js"></script>
|
||||
|
||||
<script src="../../site_libs/typedarray-0.1/typedarray.min.js"></script>
|
||||
|
||||
<script src="../../site_libs/jquery-3.5.1/jquery.min.js"></script>
|
||||
<link href="../../site_libs/crosstalk-1.2.0/css/crosstalk.min.css" rel="stylesheet">
|
||||
<script src="../../site_libs/crosstalk-1.2.0/js/crosstalk.min.js"></script>
|
||||
|
||||
<link href="../../site_libs/crosstalk-1.2.1/css/crosstalk.min.css" rel="stylesheet">
|
||||
|
||||
<script src="../../site_libs/crosstalk-1.2.1/js/crosstalk.min.js"></script>
|
||||
|
||||
<link href="../../site_libs/plotly-htmlwidgets-css-2.11.1/plotly-htmlwidgets.css" rel="stylesheet">
|
||||
|
||||
<script src="../../site_libs/plotly-main-2.11.1/plotly-latest.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../styles.css">
|
||||
</head>
|
||||
|
||||
<body class="floating nav-fixed">
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||||
<header id="quarto-header" class="headroom fixed-top quarto-banner">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="../../index.html">
|
||||
<span class="navbar-title">Kyle Belanger</span>
|
||||
</a>
|
||||
|
@ -126,22 +143,22 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../blog.html" rel="" target="">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
<a class="nav-link" href="../../blog.html">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../kyle_resume.pdf" rel="" target="">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
<a class="nav-link" href="../../kyle_resume.pdf">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
</li>
|
||||
<li class="nav-item compact">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19" rel="" target=""><i class="bi bi-github" role="img">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19"> <i class="bi bi-github" role="img">
|
||||
</i>
|
||||
<span class="menu-text"></span></a>
|
||||
<span class="menu-text"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
|
@ -177,7 +194,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
</header><div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
|
||||
<!-- sidebar -->
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation floating overflow-auto">
|
||||
<nav id="TOC" role="doc-toc" class="toc-active">
|
||||
<h2 id="toc-title">Table of contents</h2>
|
||||
|
||||
|
@ -190,7 +207,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
</ul>
|
||||
</nav>
|
||||
</nav>
|
||||
<div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
|
||||
<div id="quarto-sidebar-glass" class="quarto-sidebar-collapse-item" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item"></div>
|
||||
<!-- margin-sidebar -->
|
||||
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
|
||||
</div>
|
||||
|
@ -200,6 +217,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
|
||||
|
||||
|
||||
<p>Today’s post is all about line graphs using both ggplot for a static graph as well as a package called plotly for interactivity (more on this later). The example graph and data is again coming from Tableau for Healthcare, Chapter 10. <img src="flu_surveillance.png" class="img-fluid" alt="Example Line Graph"></p>
|
||||
<section id="load-libraries" class="level2">
|
||||
<h2 class="anchored" data-anchor-id="load-libraries">Load Libraries</h2>
|
||||
|
@ -303,7 +321,11 @@ $ fiscal_year <fct> 2013, 2013, 2013, 2013, 2
|
|||
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a>g1</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="line-graphs-and-interactivity_files/figure-html/unnamed-chunk-5-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="line-graphs-and-interactivity_files/figure-html/unnamed-chunk-5-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -332,15 +354,15 @@ $ fiscal_year <fct> 2013, 2013, 2013, 2013, 2
|
|||
<span id="cb8-19"><a href="#cb8-19" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb8-20"><a href="#cb8-20" aria-hidden="true" tabindex="-1"></a>g2</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<div class="plotly html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-577cfcde45769fdc364a" style="width:100%;height:464px;"></div>
|
||||
<script type="application/json" data-for="htmlwidget-577cfcde45769fdc364a">{"x":{"visdat":{"6590739375b3":["function () ","plotlyVisDat"]},"cur_data":"6590739375b3","attrs":{"6590739375b3":{"x":{},"y":{},"mode":"lines","hoverinfo":"y","color":{},"colors":["#a6611a","#dfc27d","#80cdc1","#018571"],"alpha_stroke":1,"sizes":[10,100],"spans":[1,20],"type":"scatter"}},"layout":{"margin":{"b":40,"l":60,"t":25,"r":10},"xaxis":{"domain":[0,1],"automargin":true,"title":"","type":"category","categoryorder":"array","categoryarray":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"]},"yaxis":{"domain":[0,1],"automargin":true,"title":"% Tests (+) for Influenza"},"title":"Flu Viral Surveillance: % Respiratory Specimens Positive for Influenza","legend":{"x":100,"y":0.5},"hovermode":"closest","showlegend":true},"source":"A","config":{"modeBarButtonsToAdd":["hoverclosest","hovercompare"],"showSendToCloud":false},"data":[{"x":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],"y":[5,13,34,33,23,17,11,6,4,3,3,3],"mode":"lines","hoverinfo":["y","y","y","y","y","y","y","y","y","y","y","y"],"type":"scatter","name":"2013","marker":{"color":"rgba(166,97,26,1)","line":{"color":"rgba(166,97,26,1)"}},"textfont":{"color":"rgba(166,97,26,1)"},"error_y":{"color":"rgba(166,97,26,1)"},"error_x":{"color":"rgba(166,97,26,1)"},"line":{"color":"rgba(166,97,26,1)"},"xaxis":"x","yaxis":"y","frame":null},{"x":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],"y":[4,8,26,27,18,12,14,10,6,4,3,2],"mode":"lines","hoverinfo":["y","y","y","y","y","y","y","y","y","y","y","y"],"type":"scatter","name":"2014","marker":{"color":"rgba(223,194,125,1)","line":{"color":"rgba(223,194,125,1)"}},"textfont":{"color":"rgba(223,194,125,1)"},"error_y":{"color":"rgba(223,194,125,1)"},"error_x":{"color":"rgba(223,194,125,1)"},"line":{"color":"rgba(223,194,125,1)"},"xaxis":"x","yaxis":"y","frame":null},{"x":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],"y":[4,13,29,23,14,12,8,4,2,2,2,2],"mode":"lines","hoverinfo":["y","y","y","y","y","y","y","y","y","y","y","y"],"type":"scatter","name":"2015","marker":{"color":"rgba(128,205,193,1)","line":{"color":"rgba(128,205,193,1)"}},"textfont":{"color":"rgba(128,205,193,1)"},"error_y":{"color":"rgba(128,205,193,1)"},"error_x":{"color":"rgba(128,205,193,1)"},"line":{"color":"rgba(128,205,193,1)"},"xaxis":"x","yaxis":"y","frame":null},{"x":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],"y":[1,1,2,6,17,20,12,5,2,1,1,2],"mode":"lines","hoverinfo":["y","y","y","y","y","y","y","y","y","y","y","y"],"type":"scatter","name":"2016","marker":{"color":"rgba(1,133,113,1)","line":{"color":"rgba(1,133,113,1)"}},"textfont":{"color":"rgba(1,133,113,1)"},"error_y":{"color":"rgba(1,133,113,1)"},"error_x":{"color":"rgba(1,133,113,1)"},"line":{"color":"rgba(1,133,113,1)"},"xaxis":"x","yaxis":"y","frame":null}],"highlight":{"on":"plotly_click","persistent":false,"dynamic":false,"selectize":false,"opacityDim":0.2,"selected":{"opacity":1},"debounce":0},"shinyEvents":["plotly_hover","plotly_click","plotly_selected","plotly_relayout","plotly_brushed","plotly_brushing","plotly_clickannotation","plotly_doubleclick","plotly_deselect","plotly_afterplot","plotly_sunburstclick"],"base_url":"https://plot.ly"},"evals":[],"jsHooks":[]}</script>
|
||||
<div class="plotly html-widget html-fill-item" id="htmlwidget-b1e3ee4d5879640cfdb4" style="width:100%;height:464px;"></div>
|
||||
<script type="application/json" data-for="htmlwidget-b1e3ee4d5879640cfdb4">{"x":{"visdat":{"53146fe27765":["function () ","plotlyVisDat"]},"cur_data":"53146fe27765","attrs":{"53146fe27765":{"x":{},"y":{},"mode":"lines","hoverinfo":"y","color":{},"colors":["#a6611a","#dfc27d","#80cdc1","#018571"],"alpha_stroke":1,"sizes":[10,100],"spans":[1,20],"type":"scatter"}},"layout":{"margin":{"b":40,"l":60,"t":25,"r":10},"xaxis":{"domain":[0,1],"automargin":true,"title":"","type":"category","categoryorder":"array","categoryarray":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"]},"yaxis":{"domain":[0,1],"automargin":true,"title":"% Tests (+) for Influenza"},"title":"Flu Viral Surveillance: % Respiratory Specimens Positive for Influenza","legend":{"x":100,"y":0.5},"hovermode":"closest","showlegend":true},"source":"A","config":{"modeBarButtonsToAdd":["hoverclosest","hovercompare"],"showSendToCloud":false},"data":[{"x":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],"y":[5,13,34,33,23,17,11,6,4,3,3,3],"mode":"lines","hoverinfo":["y","y","y","y","y","y","y","y","y","y","y","y"],"type":"scatter","name":"2013","marker":{"color":"rgba(166,97,26,1)","line":{"color":"rgba(166,97,26,1)"}},"textfont":{"color":"rgba(166,97,26,1)"},"error_y":{"color":"rgba(166,97,26,1)"},"error_x":{"color":"rgba(166,97,26,1)"},"line":{"color":"rgba(166,97,26,1)"},"xaxis":"x","yaxis":"y","frame":null},{"x":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],"y":[4,8,26,27,18,12,14,10,6,4,3,2],"mode":"lines","hoverinfo":["y","y","y","y","y","y","y","y","y","y","y","y"],"type":"scatter","name":"2014","marker":{"color":"rgba(223,194,125,1)","line":{"color":"rgba(223,194,125,1)"}},"textfont":{"color":"rgba(223,194,125,1)"},"error_y":{"color":"rgba(223,194,125,1)"},"error_x":{"color":"rgba(223,194,125,1)"},"line":{"color":"rgba(223,194,125,1)"},"xaxis":"x","yaxis":"y","frame":null},{"x":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],"y":[4,13,29,23,14,12,8,4,2,2,2,2],"mode":"lines","hoverinfo":["y","y","y","y","y","y","y","y","y","y","y","y"],"type":"scatter","name":"2015","marker":{"color":"rgba(128,205,193,1)","line":{"color":"rgba(128,205,193,1)"}},"textfont":{"color":"rgba(128,205,193,1)"},"error_y":{"color":"rgba(128,205,193,1)"},"error_x":{"color":"rgba(128,205,193,1)"},"line":{"color":"rgba(128,205,193,1)"},"xaxis":"x","yaxis":"y","frame":null},{"x":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],"y":[1,1,2,6,17,20,12,5,2,1,1,2],"mode":"lines","hoverinfo":["y","y","y","y","y","y","y","y","y","y","y","y"],"type":"scatter","name":"2016","marker":{"color":"rgba(1,133,113,1)","line":{"color":"rgba(1,133,113,1)"}},"textfont":{"color":"rgba(1,133,113,1)"},"error_y":{"color":"rgba(1,133,113,1)"},"error_x":{"color":"rgba(1,133,113,1)"},"line":{"color":"rgba(1,133,113,1)"},"xaxis":"x","yaxis":"y","frame":null}],"highlight":{"on":"plotly_click","persistent":false,"dynamic":false,"selectize":false,"opacityDim":0.20000000000000001,"selected":{"opacity":1},"debounce":0},"shinyEvents":["plotly_hover","plotly_click","plotly_selected","plotly_relayout","plotly_brushed","plotly_brushing","plotly_clickannotation","plotly_doubleclick","plotly_deselect","plotly_afterplot","plotly_sunburstclick"],"base_url":"https://plot.ly"},"evals":[],"jsHooks":[]}</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div id="quarto-reuse" class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</a></div></div></section><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2020,
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2020,
|
||||
author = {Belanger, Kyle},
|
||||
title = {Line {Graphs} and {Interactivity}},
|
||||
date = {2020-02-10},
|
||||
|
@ -429,10 +451,27 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
function tippyHover(el, contentFn) {
|
||||
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||||
var mailtoRegex = new RegExp(/^mailto:/);
|
||||
var filterRegex = new RegExp('/' + window.location.host + '/');
|
||||
var isInternal = (href) => {
|
||||
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
|
||||
}
|
||||
// Inspect non-navigation links and adorn them if external
|
||||
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool)');
|
||||
for (var i=0; i<links.length; i++) {
|
||||
const link = links[i];
|
||||
if (!isInternal(link.href)) {
|
||||
// undo the damage that might have been done by quarto-nav.js in the case of
|
||||
// links that we want to consider external
|
||||
if (link.dataset.originalHref !== undefined) {
|
||||
link.href = link.dataset.originalHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
content: contentFn,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
|
@ -442,8 +481,17 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start'
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
|
@ -455,7 +503,130 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
try { href = new URL(href).hash; } catch {}
|
||||
const id = href.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
return note.innerHTML;
|
||||
if (note) {
|
||||
return note.innerHTML;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
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++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
|
@ -499,6 +670,7 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
|
@ -524,6 +696,32 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
|
@ -587,4 +785,5 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
@ -2,7 +2,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.3.450">
|
||||
<meta name="generator" content="quarto-1.4.553">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
|
@ -24,7 +24,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
}
|
||||
/* CSS for syntax highlighting */
|
||||
pre > code.sourceCode { white-space: pre; position: relative; }
|
||||
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
|
||||
pre > code.sourceCode > span { line-height: 1.25; }
|
||||
pre > code.sourceCode > span:empty { height: 1.2em; }
|
||||
.sourceCode { overflow: visible; }
|
||||
code.sourceCode > span { color: inherit; text-decoration: inherit; }
|
||||
|
@ -81,7 +81,13 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 20,
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
|
@ -90,6 +96,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
"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"
|
||||
|
@ -103,10 +110,10 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<body class="floating nav-fixed">
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||||
<header id="quarto-header" class="headroom fixed-top quarto-banner">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="../../index.html">
|
||||
<span class="navbar-title">Kyle Belanger</span>
|
||||
</a>
|
||||
|
@ -118,22 +125,22 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../blog.html" rel="" target="">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
<a class="nav-link" href="../../blog.html">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../kyle_resume.pdf" rel="" target="">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
<a class="nav-link" href="../../kyle_resume.pdf">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
</li>
|
||||
<li class="nav-item compact">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19" rel="" target=""><i class="bi bi-github" role="img">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19"> <i class="bi bi-github" role="img">
|
||||
</i>
|
||||
<span class="menu-text"></span></a>
|
||||
<span class="menu-text"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
|
@ -169,7 +176,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
</header><div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
|
||||
<!-- sidebar -->
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation floating overflow-auto">
|
||||
<nav id="TOC" role="doc-toc" class="toc-active">
|
||||
<h2 id="toc-title">Table of contents</h2>
|
||||
|
||||
|
@ -192,7 +199,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
</ul>
|
||||
</nav>
|
||||
</nav>
|
||||
<div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
|
||||
<div id="quarto-sidebar-glass" class="quarto-sidebar-collapse-item" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item"></div>
|
||||
<!-- margin-sidebar -->
|
||||
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
|
||||
</div>
|
||||
|
@ -202,6 +209,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
|
||||
|
||||
|
||||
<section id="tldr" class="level1">
|
||||
<h1>TL:DR</h1>
|
||||
<p>Today I am going to dive into some real life data from the World Health Organization (WHO), exploring new and relapse cases of Tuberculosis. I clean up the data, and then make a few graphs to explore different variables.</p>
|
||||
|
@ -322,7 +330,11 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<span id="cb5-18"><a href="#cb5-18" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme_bw</span>() </span>
|
||||
<span id="cb5-19"><a href="#cb5-19" aria-hidden="true" tabindex="-1"></a>g1</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="basic-exploration-of-who-tuberculosis-data_files/figure-html/unnamed-chunk-5-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="basic-exploration-of-who-tuberculosis-data_files/figure-html/unnamed-chunk-5-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<section id="subset" class="level3">
|
||||
|
@ -352,7 +364,11 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<span id="cb6-21"><a href="#cb6-21" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb6-22"><a href="#cb6-22" aria-hidden="true" tabindex="-1"></a>g2</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="basic-exploration-of-who-tuberculosis-data_files/figure-html/unnamed-chunk-6-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="basic-exploration-of-who-tuberculosis-data_files/figure-html/unnamed-chunk-6-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>We can see in the graph above there seems to be a small correlation between lower GDP and amount of TB cases.</p>
|
||||
|
@ -406,7 +422,11 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<span id="cb7-43"><a href="#cb7-43" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb7-44"><a href="#cb7-44" aria-hidden="true" tabindex="-1"></a> g3 </span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="basic-exploration-of-who-tuberculosis-data_files/figure-html/unnamed-chunk-7-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="basic-exploration-of-who-tuberculosis-data_files/figure-html/unnamed-chunk-7-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<section id="further-exploration" class="level3">
|
||||
|
@ -431,7 +451,11 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<span id="cb8-16"><a href="#cb8-16" aria-hidden="true" tabindex="-1"></a> </span>
|
||||
<span id="cb8-17"><a href="#cb8-17" aria-hidden="true" tabindex="-1"></a>g4</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="basic-exploration-of-who-tuberculosis-data_files/figure-html/unnamed-chunk-8-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="basic-exploration-of-who-tuberculosis-data_files/figure-html/unnamed-chunk-8-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>There seems to be a huge spike in cases after adolescences. Females have a sharp decline the older they get, where as male case stay elevated with a slight decrease at 55.</p>
|
||||
|
@ -457,7 +481,11 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<span id="cb9-14"><a href="#cb9-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_y_continuous</span>(<span class="at">breaks =</span> scales<span class="sc">::</span><span class="fu">pretty_breaks</span>(<span class="at">n=</span><span class="dv">10</span>)) <span class="co">#different way to add tick marks</span></span>
|
||||
<span id="cb9-15"><a href="#cb9-15" aria-hidden="true" tabindex="-1"></a>g5</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="basic-exploration-of-who-tuberculosis-data_files/figure-html/unnamed-chunk-9-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="basic-exploration-of-who-tuberculosis-data_files/figure-html/unnamed-chunk-9-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>Cases were steadily rising from 1980 to 1990, then suddenly feel off. Starting in the early 2010s there was a sharp increase and the amount of new and relapse cases just keep growing.</p>
|
||||
|
@ -470,7 +498,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
</section>
|
||||
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div id="quarto-reuse" class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</a></div></div></section><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2020,
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2020,
|
||||
author = {Belanger, Kyle},
|
||||
title = {Basic {Exploration} of {WHO} {Tuberculosis} {Data}},
|
||||
date = {2020-02-13},
|
||||
|
@ -559,10 +587,27 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
function tippyHover(el, contentFn) {
|
||||
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||||
var mailtoRegex = new RegExp(/^mailto:/);
|
||||
var filterRegex = new RegExp('/' + window.location.host + '/');
|
||||
var isInternal = (href) => {
|
||||
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
|
||||
}
|
||||
// Inspect non-navigation links and adorn them if external
|
||||
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool)');
|
||||
for (var i=0; i<links.length; i++) {
|
||||
const link = links[i];
|
||||
if (!isInternal(link.href)) {
|
||||
// undo the damage that might have been done by quarto-nav.js in the case of
|
||||
// links that we want to consider external
|
||||
if (link.dataset.originalHref !== undefined) {
|
||||
link.href = link.dataset.originalHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
content: contentFn,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
|
@ -572,8 +617,17 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start'
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
|
@ -585,7 +639,130 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
try { href = new URL(href).hash; } catch {}
|
||||
const id = href.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
return note.innerHTML;
|
||||
if (note) {
|
||||
return note.innerHTML;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
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++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
|
@ -629,6 +806,7 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
|
@ -654,6 +832,32 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
|
@ -717,4 +921,5 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
@ -2,7 +2,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.3.450">
|
||||
<meta name="generator" content="quarto-1.4.553">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
|
@ -24,7 +24,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
}
|
||||
/* CSS for syntax highlighting */
|
||||
pre > code.sourceCode { white-space: pre; position: relative; }
|
||||
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
|
||||
pre > code.sourceCode > span { line-height: 1.25; }
|
||||
pre > code.sourceCode > span:empty { height: 1.2em; }
|
||||
.sourceCode { overflow: visible; }
|
||||
code.sourceCode > span { color: inherit; text-decoration: inherit; }
|
||||
|
@ -81,7 +81,13 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 20,
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
|
@ -90,6 +96,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
"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"
|
||||
|
@ -103,10 +110,10 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<body class="floating nav-fixed">
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||||
<header id="quarto-header" class="headroom fixed-top quarto-banner">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="../../index.html">
|
||||
<span class="navbar-title">Kyle Belanger</span>
|
||||
</a>
|
||||
|
@ -118,22 +125,22 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../blog.html" rel="" target="">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
<a class="nav-link" href="../../blog.html">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../kyle_resume.pdf" rel="" target="">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
<a class="nav-link" href="../../kyle_resume.pdf">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
</li>
|
||||
<li class="nav-item compact">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19" rel="" target=""><i class="bi bi-github" role="img">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19"> <i class="bi bi-github" role="img">
|
||||
</i>
|
||||
<span class="menu-text"></span></a>
|
||||
<span class="menu-text"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
|
@ -169,7 +176,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
</header><div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
|
||||
<!-- sidebar -->
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation floating overflow-auto">
|
||||
<nav id="TOC" role="doc-toc" class="toc-active">
|
||||
<h2 id="toc-title">Table of contents</h2>
|
||||
|
||||
|
@ -191,7 +198,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
</ul>
|
||||
</nav>
|
||||
</nav>
|
||||
<div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
|
||||
<div id="quarto-sidebar-glass" class="quarto-sidebar-collapse-item" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item"></div>
|
||||
<!-- margin-sidebar -->
|
||||
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
|
||||
</div>
|
||||
|
@ -201,6 +208,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
|
||||
|
||||
|
||||
<section id="problem" class="level1">
|
||||
<h1>Problem</h1>
|
||||
<p>Recently I tried to important some Microsoft Excel data into R, and ran into an issue were the data actually had two different header rows. The top row listed a group, and then the second row listed a category within that group. Searching goggle I couldn’t really find a good example of what I was looking for, so I am putting it here in hopes of helping someone else!</p>
|
||||
|
@ -375,7 +383,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
</section>
|
||||
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div id="quarto-reuse" class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</a></div></div></section><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2020,
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2020,
|
||||
author = {Belanger, Kyle},
|
||||
title = {Importing {Excel} {Data} with {Multiple} {Header} {Rows}},
|
||||
date = {2020-06-22},
|
||||
|
@ -464,10 +472,27 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
function tippyHover(el, contentFn) {
|
||||
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||||
var mailtoRegex = new RegExp(/^mailto:/);
|
||||
var filterRegex = new RegExp('/' + window.location.host + '/');
|
||||
var isInternal = (href) => {
|
||||
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
|
||||
}
|
||||
// Inspect non-navigation links and adorn them if external
|
||||
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool)');
|
||||
for (var i=0; i<links.length; i++) {
|
||||
const link = links[i];
|
||||
if (!isInternal(link.href)) {
|
||||
// undo the damage that might have been done by quarto-nav.js in the case of
|
||||
// links that we want to consider external
|
||||
if (link.dataset.originalHref !== undefined) {
|
||||
link.href = link.dataset.originalHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
content: contentFn,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
|
@ -477,8 +502,17 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start'
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
|
@ -490,7 +524,130 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
try { href = new URL(href).hash; } catch {}
|
||||
const id = href.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
return note.innerHTML;
|
||||
if (note) {
|
||||
return note.innerHTML;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
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++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
|
@ -534,6 +691,7 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
|
@ -559,6 +717,32 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
|
@ -622,4 +806,5 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
|
@ -2,7 +2,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.3.450">
|
||||
<meta name="generator" content="quarto-1.4.553">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
|
@ -24,7 +24,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
}
|
||||
/* CSS for syntax highlighting */
|
||||
pre > code.sourceCode { white-space: pre; position: relative; }
|
||||
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
|
||||
pre > code.sourceCode > span { line-height: 1.25; }
|
||||
pre > code.sourceCode > span:empty { height: 1.2em; }
|
||||
.sourceCode { overflow: visible; }
|
||||
code.sourceCode > span { color: inherit; text-decoration: inherit; }
|
||||
|
@ -60,6 +60,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
div.csl-bib-body { }
|
||||
div.csl-entry {
|
||||
clear: both;
|
||||
margin-bottom: 0em;
|
||||
}
|
||||
.hanging-indent div.csl-entry {
|
||||
margin-left:2em;
|
||||
|
@ -100,7 +101,13 @@ div.csl-indent {
|
|||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 20,
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
|
@ -109,6 +116,7 @@ div.csl-indent {
|
|||
"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"
|
||||
|
@ -122,10 +130,10 @@ div.csl-indent {
|
|||
<body class="floating nav-fixed">
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||||
<header id="quarto-header" class="headroom fixed-top quarto-banner">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="../../index.html">
|
||||
<span class="navbar-title">Kyle Belanger</span>
|
||||
</a>
|
||||
|
@ -137,22 +145,22 @@ div.csl-indent {
|
|||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../blog.html" rel="" target="">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
<a class="nav-link" href="../../blog.html">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../kyle_resume.pdf" rel="" target="">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
<a class="nav-link" href="../../kyle_resume.pdf">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
</li>
|
||||
<li class="nav-item compact">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19" rel="" target=""><i class="bi bi-github" role="img">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19"> <i class="bi bi-github" role="img">
|
||||
</i>
|
||||
<span class="menu-text"></span></a>
|
||||
<span class="menu-text"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
|
@ -188,7 +196,7 @@ div.csl-indent {
|
|||
|
||||
</header><div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
|
||||
<!-- sidebar -->
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation floating overflow-auto">
|
||||
<nav id="TOC" role="doc-toc" class="toc-active">
|
||||
<h2 id="toc-title">Table of contents</h2>
|
||||
|
||||
|
@ -213,7 +221,7 @@ div.csl-indent {
|
|||
</ul>
|
||||
</nav>
|
||||
</nav>
|
||||
<div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
|
||||
<div id="quarto-sidebar-glass" class="quarto-sidebar-collapse-item" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item"></div>
|
||||
<!-- margin-sidebar -->
|
||||
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
|
||||
</div>
|
||||
|
@ -223,6 +231,7 @@ div.csl-indent {
|
|||
|
||||
|
||||
|
||||
|
||||
<section id="update" class="level1">
|
||||
<h1>Update</h1>
|
||||
<p>2022-15-03: Since this was posted the CDC has updated how county level diabetes prevalance is calculated. The data presented here is using previous calcualtions and may no longer be correct. More can be read <a href="https://www.cdc.gov/diabetes/data/statistics/faqs.html">here</a></p>
|
||||
|
@ -261,7 +270,7 @@ div.csl-indent {
|
|||
<p><strong><em>This section contains technical information for deeper analysis and reproduction. Casual readers are invited to skip it.</em></strong></p>
|
||||
<p>Packages used in this report.</p>
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Attach these packages so their functions don't need to be qualified: http://r-pkgs.had.co.nz/namespace.html#search-path</span></span>
|
||||
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(magrittr) <span class="co"># enables piping : %>%</span></span>
|
||||
|
@ -276,7 +285,7 @@ div.csl-indent {
|
|||
</div>
|
||||
<p>Definitions of global object (file paths, factor levels, object groups ) used throughout the report.</p>
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="co">#set ggplot theme</span></span>
|
||||
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>ggplot2<span class="sc">::</span><span class="fu">theme_set</span>(<span class="fu">theme_bw</span>())</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
|
@ -293,7 +302,7 @@ div.csl-indent {
|
|||
</ol>
|
||||
<!-- Load the datasets. -->
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="co"># load the data, and have all column names in lowercase</span></span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
|
@ -315,7 +324,7 @@ div.csl-indent {
|
|||
</div>
|
||||
<!-- load map data -->
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="co"># load in both US State Map and NC County Map</span></span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
|
@ -339,7 +348,7 @@ div.csl-indent {
|
|||
<h3 class="anchored" data-anchor-id="tweaks">Tweaks</h3>
|
||||
<!-- Tweak the datasets. -->
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>county_centers <span class="ot"><-</span> county_centers_raw <span class="sc">%>%</span> </span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate_all</span>(<span class="sc">~</span>stringr<span class="sc">::</span><span class="fu">str_replace_all</span>(.,</span>
|
||||
|
@ -378,7 +387,7 @@ div.csl-indent {
|
|||
<h3 class="anchored" data-anchor-id="merge">Merge</h3>
|
||||
<!-- Merge datasets -->
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="co">#join US totals to NC data </span></span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
|
@ -408,7 +417,7 @@ div.csl-indent {
|
|||
<section id="overall---national-level" class="level1">
|
||||
<h1>Overall - National Level</h1>
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>us_diabetes_data <span class="ot"><-</span> us_diabetes_data <span class="sc">%>%</span> </span>
|
||||
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(</span>
|
||||
|
@ -439,7 +448,11 @@ div.csl-indent {
|
|||
<span id="cb7-27"><a href="#cb7-27" aria-hidden="true" tabindex="-1"></a>o_g1</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
</details>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/o-g1-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/o-g1-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>Overall, the national average for diagnosed diabetes sharply rose through the early 2000’s, leveling off around 2010. These numbers however, are estimates based on the self-reported response to the CDC’s National Health Interview Survey, and do not represent the actual confirmed diagnoses. The CDC estimates that 1 in 5 adults have undiagnosed diabetes, therefore the numbers reported by the NHIS are likely to underestimate the true prevalence <span class="citation" data-cites="CDCP2020">(<a href="#ref-CDCP2020" role="doc-biblioref">Centers for Disease Control and Prevention, 2020</a>)</span>.</p>
|
||||
|
@ -448,7 +461,7 @@ div.csl-indent {
|
|||
<h1>Overall - State Level</h1>
|
||||
<p>State and County level data on diabetes prevalence are taken from the CDC’s Behavioral Risk Factor Surveillance System <a href="https://www.cdc.gov/brfss/index.html">(BRFSS)</a>. These results are based on the question “Has a doctor, nurse, or other health professional ever told you that you have diabetes?”. Women who only experienced diabetes during pregnancy were excluded from the counts. The BRFSS is an ongoing, monthly telephone survey of the non-institutionalized adults (aged 18 years or older) in each state. The year 2011 saw a major change to the methodology of the survey, which started to include homes without a landline phone. This change was expected to increase coverage of lower income, lower educational levels, and younger age groups, because these groups often exclusively rely on cellular telephones for personal communication.<span class="citation" data-cites="Pierannunzi2012">(<a href="#ref-Pierannunzi2012" role="doc-biblioref">Pierannunzi et al., 2012</a>)</span></p>
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a>s_g1 <span class="ot"><-</span> state_map <span class="sc">%>%</span> </span>
|
||||
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">st_drop_geometry</span>() <span class="sc">%>%</span> </span>
|
||||
|
@ -474,12 +487,16 @@ div.csl-indent {
|
|||
<span id="cb8-22"><a href="#cb8-22" aria-hidden="true" tabindex="-1"></a>s_g1</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
</details>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/s-g1-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/s-g1-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>The above graph shows diabetes prevalence trends by state, grouped into regions based on the US Census classification <a href="https://www2.census.gov/geo/pdfs/maps-data/maps/reference/us_regdiv.pdf">regions</a>. While all regions of the United states show positive growth in diabetes prevalence, the south exhibits a slightly higher growth rate, as well as the highest prevalence.</p>
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a>s_g2 <span class="ot"><-</span> state_map <span class="sc">%>%</span> </span>
|
||||
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">st_drop_geometry</span>() <span class="sc">%>%</span> </span>
|
||||
|
@ -501,7 +518,11 @@ div.csl-indent {
|
|||
<span id="cb9-18"><a href="#cb9-18" aria-hidden="true" tabindex="-1"></a>s_g2</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
</details>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/s-g2-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/s-g2-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>When focusing on the south region, North Carolina falls close to the middle of diabetes prevalence.</p>
|
||||
|
@ -510,7 +531,7 @@ div.csl-indent {
|
|||
<h1>Overall - North Carolina</h1>
|
||||
<p>When examining the trajectory for North Carolina, we can see that it has been consistently higher than national average . We see that in 2016 there was a large spike in diagnosed cases; unfortunately this is the last available year so it is unclear whether the upward trend continues. The graph below compares state-level average to the national average. Notice that the trend line is slightly higher than in the previous graphs: this is due to the age cut offs used for National and State level data vs County Level data. Previous data used 18 years of age as a cutoff for classifying adults, whereas the county level data uses 20. Due to removing 18- and 19-year-olds from the population, who typically have less diagnosed cases of diabetes than those of older ages, the computed prevalence increases slightly.</p>
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a>d1 <span class="ot"><-</span> nc_diabetes_data <span class="sc">%>%</span> </span>
|
||||
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">group_by</span>(year) <span class="sc">%>%</span> </span>
|
||||
|
@ -546,12 +567,16 @@ div.csl-indent {
|
|||
<span id="cb10-32"><a href="#cb10-32" aria-hidden="true" tabindex="-1"></a>nc_g1 </span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
</details>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/nc-g1-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/nc-g1-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>We see a spike in 2016, the last year for which the data are available. However, we should be careful with our interpretation of this pattern, because the examination of the county-level trajectories reveals an aberration in the trend that requires a more rigorous investigation.</p>
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>nc_g1a <span class="ot"><-</span> nc_diabetes_data <span class="sc">%>%</span> </span>
|
||||
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x =</span> year, <span class="at">y =</span> percentage)) <span class="sc">+</span></span>
|
||||
|
@ -565,12 +590,16 @@ div.csl-indent {
|
|||
<span id="cb11-10"><a href="#cb11-10" aria-hidden="true" tabindex="-1"></a>nc_g1a</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
</details>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/nc-data-aberration-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/nc-data-aberration-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>While all of North Carolina has a higher prevalence than the national average, rural counties have systematically higher prevalence of diabetes than urban counties. Note that after 2011 both Urban and Rural counties break the upward trend exhibited in the previous 5 years. This could be explained by the addition of cell phones to the BRFS Survey as many rural areas are often lower income areas and may only rely on a cell phone for communication. As mentioned previously there is an odd spike in case in 2016 that can’t be explained by current documentation. For the purpose of this evaluation 2016 will be excluded from the county level data since the odd trend can not be explained and no further data is available to determine if this is a real spike or could be attributed to methodology change or data quality.</p>
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a>d2 <span class="ot"><-</span> nc_diabetes_data <span class="sc">%>%</span> </span>
|
||||
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">select</span>(<span class="sc">-</span>us_pct) <span class="sc">%>%</span> </span>
|
||||
|
@ -613,7 +642,11 @@ div.csl-indent {
|
|||
<span id="cb12-39"><a href="#cb12-39" aria-hidden="true" tabindex="-1"></a>nc_g2</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
</details>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/nc-g2-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/nc-g2-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -621,7 +654,7 @@ div.csl-indent {
|
|||
<h1>By County - Geographical</h1>
|
||||
<p>County level data first became available in 2004, three years of data is used to arrive at these estimates. For example, the 2006 estimates were computed using the data from 2005, 2006, and 2007 BRFS survey rounds. The county-level estimates were based on indirect model-dependent estimates using Bayesian multilevel modeling techniques<span class="citation" data-cites="Rao2003 Barker2013">(<a href="#ref-Rao2003" role="doc-biblioref">JNK, 2003</a> ; <a href="#ref-Barker2013" role="doc-biblioref">Barker et al., 2013</a>)</span>. This model-dependent approach employs a statistical model that “borrows strength” in making an estimate for one county from BRFSS data collected in other counties and states. Multilevel Binomial regression models with random effects of demographic variables (age 20-44, 45-64, >=65; race/ethnicity; sex) at the county-level were developed. Estimates were adjusted for age to the 2000 US standard population using age groups of 20-44, 45-64, and 65 or older<span class="citation" data-cites="Klein2001">(<a href="#ref-Klein2001" role="doc-biblioref">Klein & Schoenborn, 2001</a>)</span>.</p>
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb13"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a>g50 <span class="ot"><-</span> nc_diabetes_data <span class="sc">%>%</span> </span>
|
||||
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(year <span class="sc"><</span> <span class="dv">2015</span>) <span class="sc">%>%</span> </span>
|
||||
|
@ -645,13 +678,17 @@ div.csl-indent {
|
|||
<span id="cb13-20"><a href="#cb13-20" aria-hidden="true" tabindex="-1"></a>g50</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
</details>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/spaghetti-plot-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/spaghetti-plot-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>When viewing all county trend lines together, we see that the loess line for both urban and rural follows a similar trend for the time period.</p>
|
||||
<p>The following graphs displays the total estimated prevalence of Diabetes in each off the 100 North Carolina counties. To keep the scaling consistent between the graphs, we binned the estimates into 6 intervals of the same size. Rural counties are highlighted with a stronger border line as well as a letter “R” in respective geographic centers. These graphs allow us to view geographical clusters of diabetes prevalence.</p>
|
||||
<div class="cell page-columns page-full">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a>nc_counties_map_binned <span class="ot"><-</span> nc_counties_map <span class="sc">%>%</span> </span>
|
||||
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(year <span class="sc"><</span> <span class="dv">2015</span>) <span class="sc">%>%</span> </span>
|
||||
|
@ -707,13 +744,17 @@ div.csl-indent {
|
|||
<span id="cb14-52"><a href="#cb14-52" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb14-53"><a href="#cb14-53" aria-hidden="true" tabindex="-1"></a>c_g1</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
</details>
|
||||
<div class="cell-output-display column-body-outset">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/c-g1-1.png" class="img-fluid" width="672"></p>
|
||||
<div class="cell-output-display page-columns page-full">
|
||||
<div class="page-columns page-full">
|
||||
<figure class="figure page-columns page-full">
|
||||
<p class="page-columns page-full"><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/c-g1-1.png" class="img-fluid figure-img column-body-outset" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>The following box plot displays the distribution of estimated cases by county from 2006 to 2014. For all years of current data the mean of rural counties is higher then that of their Urban counterparts.</p>
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb15"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a>c_g1c <span class="ot"><-</span> nc_counties_map <span class="sc">%>%</span> </span>
|
||||
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(</span>
|
||||
|
@ -736,7 +777,11 @@ div.csl-indent {
|
|||
<span id="cb15-19"><a href="#cb15-19" aria-hidden="true" tabindex="-1"></a>c_g1c</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
</details>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/county-boxplot-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/county-boxplot-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -744,7 +789,7 @@ div.csl-indent {
|
|||
<h1>By County - Percent Change</h1>
|
||||
<p>The following graphs display the overall change in estimated prevalence between 2006 to 2014.</p>
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb16"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a>d3 <span class="ot"><-</span> nc_counties_map <span class="sc">%>%</span> </span>
|
||||
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">st_drop_geometry</span>() <span class="sc">%>%</span> </span>
|
||||
|
@ -802,12 +847,16 @@ div.csl-indent {
|
|||
<span id="cb16-54"><a href="#cb16-54" aria-hidden="true" tabindex="-1"></a>c_g4</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
</details>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/c-g4-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/c-g4-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>The following chart displays the density curve of the percentage change for both rural and urban counties. It is notable that the mean of change for Urban counties is actually higher than the mean for rural counties. However, we also see that most change for both regions is positive growth. In fact only 16 rural, and 10 Urban counties experienced negative change in the given time frame. While 35 rural and 34 urban counties experience growth in the same period.</p>
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb17"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a>d4 <span class="ot"><-</span> d3 <span class="sc">%>%</span> </span>
|
||||
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">st_drop_geometry</span>() <span class="sc">%>%</span> </span>
|
||||
|
@ -847,7 +896,11 @@ div.csl-indent {
|
|||
<span id="cb17-36"><a href="#cb17-36" aria-hidden="true" tabindex="-1"></a>g51</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
</details>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/pct_p-histogram-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="diabetes-in-rural-north-carolina-exploring-prevalence-trends_files/figure-html/pct_p-histogram-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -864,7 +917,7 @@ div.csl-indent {
|
|||
Environment <span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</summary>
|
||||
<div class="cell">
|
||||
<details>
|
||||
<details class="code-fold">
|
||||
<summary>Code</summary>
|
||||
<div class="sourceCode cell-code" id="cb18"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span>( <span class="fu">requireNamespace</span>(<span class="st">"devtools"</span>, <span class="at">quietly =</span> <span class="cn">TRUE</span>) ) {</span>
|
||||
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a> devtools<span class="sc">::</span><span class="fu">session_info</span>()</span>
|
||||
|
@ -875,152 +928,139 @@ Environment <span class="glyphicon glyphicon-plus-sign"></span>
|
|||
<div class="cell-output cell-output-stdout">
|
||||
<pre><code>─ Session info ───────────────────────────────────────────────────────────────
|
||||
setting value
|
||||
version R version 4.2.1 (2022-06-23 ucrt)
|
||||
os Windows 10 x64 (build 22621)
|
||||
version R version 4.3.3 (2024-02-29 ucrt)
|
||||
os Windows 11 x64 (build 22621)
|
||||
system x86_64, mingw32
|
||||
ui RTerm
|
||||
language (EN)
|
||||
collate English_United States.utf8
|
||||
ctype English_United States.utf8
|
||||
tz America/New_York
|
||||
date 2023-10-12
|
||||
pandoc 3.1.8 @ C:/PROGRA~1/Pandoc/ (via rmarkdown)
|
||||
date 2024-06-08
|
||||
pandoc 3.2 @ C:/Users/belangew/AppData/Local/Pandoc/ (via rmarkdown)
|
||||
|
||||
─ Packages ───────────────────────────────────────────────────────────────────
|
||||
package * version date (UTC) lib source
|
||||
bit 4.0.4 2020-08-04 [1] CRAN (R 4.2.2)
|
||||
bit64 4.0.5 2020-08-30 [1] CRAN (R 4.2.2)
|
||||
cachem 1.0.6 2021-08-19 [1] CRAN (R 4.2.2)
|
||||
callr 3.7.3 2022-11-02 [1] CRAN (R 4.2.2)
|
||||
class 7.3-20 2022-01-16 [2] CRAN (R 4.2.1)
|
||||
classInt 0.4-10 2023-09-05 [1] CRAN (R 4.2.3)
|
||||
cli 3.4.1 2022-09-23 [1] CRAN (R 4.2.2)
|
||||
colorspace 2.0-3 2022-02-21 [1] CRAN (R 4.2.2)
|
||||
confintr 1.0.2 2023-06-04 [1] CRAN (R 4.2.3)
|
||||
crayon 1.5.2 2022-09-29 [1] CRAN (R 4.2.2)
|
||||
crul 1.4.0 2023-05-17 [1] CRAN (R 4.2.3)
|
||||
curl 4.3.3 2022-10-06 [1] CRAN (R 4.2.2)
|
||||
DBI 1.1.3 2022-06-18 [1] CRAN (R 4.2.2)
|
||||
devtools 2.4.5 2022-10-11 [1] CRAN (R 4.2.2)
|
||||
digest 0.6.30 2022-10-18 [1] CRAN (R 4.2.2)
|
||||
dlookr 0.6.2 2023-07-01 [1] CRAN (R 4.2.3)
|
||||
dplyr * 1.1.3 2023-09-03 [1] CRAN (R 4.2.3)
|
||||
e1071 1.7-13 2023-02-01 [1] CRAN (R 4.2.3)
|
||||
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.2.2)
|
||||
evaluate 0.21 2023-05-05 [1] CRAN (R 4.2.3)
|
||||
extrafont 0.19 2023-01-18 [1] CRAN (R 4.2.2)
|
||||
extrafontdb 1.0 2012-06-11 [1] CRAN (R 4.2.0)
|
||||
fansi 1.0.3 2022-03-24 [1] CRAN (R 4.2.2)
|
||||
farver 2.1.1 2022-07-06 [1] CRAN (R 4.2.2)
|
||||
fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.2)
|
||||
fontBitstreamVera 0.1.1 2017-02-01 [1] CRAN (R 4.2.0)
|
||||
fontLiberation 0.1.0 2016-10-15 [1] CRAN (R 4.2.0)
|
||||
fontquiver 0.2.1 2017-02-01 [1] CRAN (R 4.2.3)
|
||||
forcats 1.0.0 2023-01-29 [1] CRAN (R 4.2.3)
|
||||
Formula 1.2-5 2023-02-24 [1] CRAN (R 4.2.2)
|
||||
fs 1.5.2 2021-12-08 [1] CRAN (R 4.2.2)
|
||||
gdtools 0.3.3 2023-03-27 [1] CRAN (R 4.2.3)
|
||||
generics 0.1.3 2022-07-05 [1] CRAN (R 4.2.2)
|
||||
gfonts 0.2.0 2023-01-08 [1] CRAN (R 4.2.3)
|
||||
gghighlight 0.4.0 2022-10-16 [1] CRAN (R 4.2.3)
|
||||
ggplot2 * 3.4.2 2023-04-03 [1] CRAN (R 4.2.3)
|
||||
ggpmisc 0.5.4-1 2023-08-13 [1] CRAN (R 4.2.3)
|
||||
ggpp 0.5.4 2023-08-12 [1] CRAN (R 4.2.3)
|
||||
ggrepel 0.9.3 2023-02-03 [1] CRAN (R 4.2.3)
|
||||
glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.2)
|
||||
gridExtra 2.3 2017-09-09 [1] CRAN (R 4.2.2)
|
||||
gtable 0.3.3 2023-03-21 [1] CRAN (R 4.2.3)
|
||||
hms 1.1.3 2023-03-21 [1] CRAN (R 4.2.3)
|
||||
hrbrthemes 0.8.0 2020-03-06 [1] CRAN (R 4.2.3)
|
||||
htmltools 0.5.4 2022-12-07 [1] CRAN (R 4.2.2)
|
||||
htmlwidgets 1.6.2 2023-03-17 [1] CRAN (R 4.2.3)
|
||||
httpcode 0.3.0 2020-04-10 [1] CRAN (R 4.2.3)
|
||||
httpuv 1.6.8 2023-01-12 [1] CRAN (R 4.2.2)
|
||||
httr 1.4.6 2023-05-08 [1] CRAN (R 4.2.3)
|
||||
inum 1.0-5 2023-03-09 [1] CRAN (R 4.2.3)
|
||||
jsonlite 1.8.3 2022-10-21 [1] CRAN (R 4.2.2)
|
||||
kableExtra 1.3.4 2021-02-20 [1] CRAN (R 4.2.2)
|
||||
KernSmooth 2.23-20 2021-05-03 [2] CRAN (R 4.2.1)
|
||||
knitr 1.43 2023-05-25 [1] CRAN (R 4.2.3)
|
||||
labeling 0.4.2 2020-10-20 [1] CRAN (R 4.2.0)
|
||||
later 1.3.0 2021-08-18 [1] CRAN (R 4.2.2)
|
||||
lattice 0.20-45 2021-09-22 [2] CRAN (R 4.2.1)
|
||||
libcoin 1.0-10 2023-09-27 [1] CRAN (R 4.2.3)
|
||||
lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.2.2)
|
||||
magrittr * 2.0.3 2022-03-30 [1] CRAN (R 4.2.2)
|
||||
mapdata * 2.3.1 2022-11-01 [1] CRAN (R 4.2.3)
|
||||
maps * 3.4.1 2022-10-30 [1] CRAN (R 4.2.3)
|
||||
MASS 7.3-60 2023-05-04 [1] CRAN (R 4.2.3)
|
||||
Matrix 1.5-4.1 2023-05-18 [1] CRAN (R 4.2.3)
|
||||
MatrixModels 0.5-1 2022-09-11 [1] CRAN (R 4.2.3)
|
||||
memoise 2.0.1 2021-11-26 [1] CRAN (R 4.2.2)
|
||||
mgcv 1.8-40 2022-03-29 [2] CRAN (R 4.2.1)
|
||||
mime 0.12 2021-09-28 [1] CRAN (R 4.2.0)
|
||||
miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.2.2)
|
||||
munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.2)
|
||||
mvtnorm 1.2-2 2023-06-08 [1] CRAN (R 4.2.3)
|
||||
nlme 3.1-157 2022-03-25 [2] CRAN (R 4.2.1)
|
||||
pagedown 0.20 2022-12-13 [1] CRAN (R 4.2.3)
|
||||
partykit 1.2-20 2023-04-14 [1] CRAN (R 4.2.3)
|
||||
pillar 1.9.0 2023-03-22 [1] CRAN (R 4.2.3)
|
||||
pkgbuild 1.4.2 2023-06-26 [1] CRAN (R 4.2.1)
|
||||
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.2)
|
||||
pkgload 1.3.2 2022-11-16 [1] CRAN (R 4.2.2)
|
||||
polynom 1.4-1 2022-04-11 [1] CRAN (R 4.2.3)
|
||||
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.2.2)
|
||||
processx 3.8.1 2023-04-18 [1] CRAN (R 4.2.3)
|
||||
profvis 0.3.8 2023-05-02 [1] CRAN (R 4.2.3)
|
||||
promises 1.2.0.1 2021-02-11 [1] CRAN (R 4.2.2)
|
||||
proxy 0.4-27 2022-06-09 [1] CRAN (R 4.2.3)
|
||||
ps 1.7.5 2023-04-18 [1] CRAN (R 4.2.3)
|
||||
purrr 1.0.1 2023-01-10 [1] CRAN (R 4.2.3)
|
||||
quantreg 5.95 2023-04-08 [1] CRAN (R 4.2.3)
|
||||
R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.2)
|
||||
RColorBrewer 1.1-3 2022-04-03 [1] CRAN (R 4.2.0)
|
||||
Rcpp 1.0.9 2022-07-08 [1] CRAN (R 4.2.2)
|
||||
reactable 0.4.4 2023-03-12 [1] CRAN (R 4.2.3)
|
||||
readr * 2.1.3 2022-10-01 [1] CRAN (R 4.2.2)
|
||||
remotes 2.4.2 2021-11-30 [1] CRAN (R 4.2.2)
|
||||
rlang 1.1.0 2023-03-14 [1] CRAN (R 4.2.3)
|
||||
rmarkdown 2.22 2023-06-01 [1] CRAN (R 4.2.3)
|
||||
rpart 4.1.16 2022-01-24 [2] CRAN (R 4.2.1)
|
||||
rstudioapi 0.14 2022-08-22 [1] CRAN (R 4.2.2)
|
||||
Rttf2pt1 1.3.12 2023-01-22 [1] CRAN (R 4.2.2)
|
||||
rvest 1.0.3 2022-08-19 [1] CRAN (R 4.2.3)
|
||||
scales 1.2.1 2022-08-20 [1] CRAN (R 4.2.2)
|
||||
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.2)
|
||||
sf * 1.0-14 2023-07-11 [1] CRAN (R 4.2.3)
|
||||
shiny 1.7.4 2022-12-15 [1] CRAN (R 4.2.1)
|
||||
showtext 0.9-6 2023-05-03 [1] CRAN (R 4.2.3)
|
||||
showtextdb 3.0 2020-06-04 [1] CRAN (R 4.2.3)
|
||||
snakecase 0.11.0 2019-05-25 [1] CRAN (R 4.2.2)
|
||||
SparseM 1.81 2021-02-18 [1] CRAN (R 4.2.0)
|
||||
stringi 1.7.8 2022-07-11 [1] CRAN (R 4.2.1)
|
||||
stringr 1.5.0 2022-12-02 [1] CRAN (R 4.2.3)
|
||||
survival 3.3-1 2022-03-03 [2] CRAN (R 4.2.1)
|
||||
svglite 2.1.1 2023-01-10 [1] CRAN (R 4.2.2)
|
||||
sysfonts 0.8.8 2022-03-13 [1] CRAN (R 4.2.3)
|
||||
systemfonts 1.0.4 2022-02-11 [1] CRAN (R 4.2.2)
|
||||
tibble 3.2.1 2023-03-20 [1] CRAN (R 4.2.3)
|
||||
tidyr * 1.3.0 2023-01-24 [1] CRAN (R 4.2.3)
|
||||
tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.2.2)
|
||||
tzdb 0.3.0 2022-03-28 [1] CRAN (R 4.2.2)
|
||||
units 0.8-4 2023-09-13 [1] CRAN (R 4.2.3)
|
||||
urlchecker 1.0.1 2021-11-30 [1] CRAN (R 4.2.2)
|
||||
usethis 2.2.1 2023-06-23 [1] CRAN (R 4.2.3)
|
||||
utf8 1.2.2 2021-07-24 [1] CRAN (R 4.2.2)
|
||||
vctrs 0.6.2 2023-04-19 [1] CRAN (R 4.2.3)
|
||||
viridisLite 0.4.2 2023-05-02 [1] CRAN (R 4.2.3)
|
||||
vroom 1.6.0 2022-09-30 [1] CRAN (R 4.2.2)
|
||||
webshot 0.5.4 2022-09-26 [1] CRAN (R 4.2.2)
|
||||
withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.2)
|
||||
xfun 0.39 2023-04-20 [1] CRAN (R 4.2.3)
|
||||
xml2 1.3.5 2023-07-06 [1] CRAN (R 4.2.3)
|
||||
xtable 1.8-4 2019-04-21 [1] CRAN (R 4.2.2)
|
||||
yaml 2.3.6 2022-10-18 [1] CRAN (R 4.2.1)
|
||||
package * version date (UTC) lib source
|
||||
bit 4.0.5 2022-11-15 [1] CRAN (R 4.3.3)
|
||||
bit64 4.0.5 2020-08-30 [1] CRAN (R 4.3.3)
|
||||
cachem 1.0.8 2023-05-01 [1] CRAN (R 4.3.3)
|
||||
class 7.3-22 2023-05-03 [2] CRAN (R 4.3.3)
|
||||
classInt 0.4-10 2023-09-05 [1] CRAN (R 4.3.3)
|
||||
cli 3.6.2 2023-12-11 [1] CRAN (R 4.3.3)
|
||||
colorspace 2.1-0 2023-01-23 [1] CRAN (R 4.3.3)
|
||||
confintr 1.0.2 2023-06-04 [1] CRAN (R 4.3.3)
|
||||
crayon 1.5.2 2022-09-29 [1] CRAN (R 4.3.3)
|
||||
crul 1.4.2 2024-04-09 [1] CRAN (R 4.3.3)
|
||||
curl 5.2.1 2024-03-01 [1] CRAN (R 4.3.3)
|
||||
DBI 1.2.3 2024-06-02 [1] CRAN (R 4.3.3)
|
||||
devtools 2.4.5 2022-10-11 [1] CRAN (R 4.3.3)
|
||||
digest 0.6.35 2024-03-11 [1] CRAN (R 4.3.3)
|
||||
dlookr 0.6.3 2024-02-07 [1] CRAN (R 4.3.3)
|
||||
dplyr * 1.1.4 2023-11-17 [1] CRAN (R 4.3.3)
|
||||
e1071 1.7-14 2023-12-06 [1] CRAN (R 4.3.3)
|
||||
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.3.3)
|
||||
evaluate 0.23 2023-11-01 [1] CRAN (R 4.3.3)
|
||||
extrafont 0.19 2023-01-18 [1] CRAN (R 4.3.1)
|
||||
extrafontdb 1.0 2012-06-11 [1] CRAN (R 4.3.1)
|
||||
fansi 1.0.6 2023-12-08 [1] CRAN (R 4.3.3)
|
||||
farver 2.1.2 2024-05-13 [1] CRAN (R 4.3.3)
|
||||
fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.3)
|
||||
fontBitstreamVera 0.1.1 2017-02-01 [1] CRAN (R 4.3.1)
|
||||
fontLiberation 0.1.0 2016-10-15 [1] CRAN (R 4.3.1)
|
||||
fontquiver 0.2.1 2017-02-01 [1] CRAN (R 4.3.3)
|
||||
forcats 1.0.0 2023-01-29 [1] CRAN (R 4.3.3)
|
||||
fs 1.6.3 2023-07-20 [1] CRAN (R 4.3.3)
|
||||
gdtools 0.3.7 2024-03-05 [1] CRAN (R 4.3.3)
|
||||
generics 0.1.3 2022-07-05 [1] CRAN (R 4.3.3)
|
||||
gfonts 0.2.0 2023-01-08 [1] CRAN (R 4.3.3)
|
||||
gghighlight 0.4.1 2023-12-16 [1] CRAN (R 4.3.3)
|
||||
ggplot2 * 3.5.1 2024-04-23 [1] CRAN (R 4.3.3)
|
||||
ggpmisc 0.5.6 2024-05-07 [1] CRAN (R 4.3.3)
|
||||
ggpp 0.5.7 2024-05-06 [1] CRAN (R 4.3.3)
|
||||
ggrepel 0.9.5 2024-01-10 [1] CRAN (R 4.3.3)
|
||||
glue 1.7.0 2024-01-09 [1] CRAN (R 4.3.3)
|
||||
gridExtra 2.3 2017-09-09 [1] CRAN (R 4.3.3)
|
||||
gtable 0.3.5 2024-04-22 [1] CRAN (R 4.3.3)
|
||||
hms 1.1.3 2023-03-21 [1] CRAN (R 4.3.3)
|
||||
hrbrthemes 0.8.7 2024-03-04 [1] CRAN (R 4.3.3)
|
||||
htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.3.3)
|
||||
htmlwidgets 1.6.4 2023-12-06 [1] CRAN (R 4.3.3)
|
||||
httpcode 0.3.0 2020-04-10 [1] CRAN (R 4.3.3)
|
||||
httpuv 1.6.15 2024-03-26 [1] CRAN (R 4.3.3)
|
||||
jsonlite 1.8.8 2023-12-04 [1] CRAN (R 4.3.3)
|
||||
kableExtra 1.4.0 2024-01-24 [1] CRAN (R 4.3.3)
|
||||
KernSmooth 2.23-22 2023-07-10 [2] CRAN (R 4.3.3)
|
||||
knitr 1.46 2024-04-06 [1] CRAN (R 4.3.3)
|
||||
labeling 0.4.3 2023-08-29 [1] CRAN (R 4.3.1)
|
||||
later 1.3.2 2023-12-06 [1] CRAN (R 4.3.3)
|
||||
lattice 0.22-5 2023-10-24 [2] CRAN (R 4.3.3)
|
||||
lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.3.3)
|
||||
magrittr * 2.0.3 2022-03-30 [1] CRAN (R 4.3.3)
|
||||
mapdata * 2.3.1 2022-11-01 [1] CRAN (R 4.3.3)
|
||||
maps * 3.4.2 2023-12-15 [1] CRAN (R 4.3.3)
|
||||
MASS 7.3-60.0.1 2024-01-13 [2] CRAN (R 4.3.3)
|
||||
Matrix 1.6-5 2024-01-11 [2] CRAN (R 4.3.3)
|
||||
MatrixModels 0.5-3 2023-11-06 [1] CRAN (R 4.3.3)
|
||||
memoise 2.0.1 2021-11-26 [1] CRAN (R 4.3.3)
|
||||
mgcv 1.9-1 2023-12-21 [2] CRAN (R 4.3.3)
|
||||
mime 0.12 2021-09-28 [1] CRAN (R 4.3.1)
|
||||
miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.3.3)
|
||||
munsell 0.5.1 2024-04-01 [1] CRAN (R 4.3.3)
|
||||
nlme 3.1-164 2023-11-27 [2] CRAN (R 4.3.3)
|
||||
pagedown 0.20 2022-12-13 [1] CRAN (R 4.3.3)
|
||||
pillar 1.9.0 2023-03-22 [1] CRAN (R 4.3.3)
|
||||
pkgbuild 1.4.4 2024-03-17 [1] CRAN (R 4.3.3)
|
||||
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.3.3)
|
||||
pkgload 1.3.4 2024-01-16 [1] CRAN (R 4.3.3)
|
||||
polynom 1.4-1 2022-04-11 [1] CRAN (R 4.3.3)
|
||||
profvis 0.3.8 2023-05-02 [1] CRAN (R 4.3.3)
|
||||
promises 1.3.0 2024-04-05 [1] CRAN (R 4.3.3)
|
||||
proxy 0.4-27 2022-06-09 [1] CRAN (R 4.3.3)
|
||||
purrr 1.0.2 2023-08-10 [1] CRAN (R 4.3.3)
|
||||
quantreg 5.97 2023-08-19 [1] CRAN (R 4.3.3)
|
||||
R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.3)
|
||||
RColorBrewer 1.1-3 2022-04-03 [1] CRAN (R 4.3.1)
|
||||
Rcpp 1.0.12 2024-01-09 [1] CRAN (R 4.3.3)
|
||||
reactable 0.4.4 2023-03-12 [1] CRAN (R 4.3.3)
|
||||
readr * 2.1.5 2024-01-10 [1] CRAN (R 4.3.3)
|
||||
remotes 2.5.0 2024-03-17 [1] CRAN (R 4.3.3)
|
||||
rlang 1.1.3 2024-01-10 [1] CRAN (R 4.3.3)
|
||||
rmarkdown 2.26 2024-03-05 [1] CRAN (R 4.3.3)
|
||||
rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.3.3)
|
||||
Rttf2pt1 1.3.12 2023-01-22 [1] CRAN (R 4.3.1)
|
||||
scales 1.3.0 2023-11-28 [1] CRAN (R 4.3.3)
|
||||
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.3)
|
||||
sf * 1.0-16 2024-03-24 [1] CRAN (R 4.3.3)
|
||||
shiny 1.8.1.1 2024-04-02 [1] CRAN (R 4.3.3)
|
||||
showtext 0.9-7 2024-03-02 [1] CRAN (R 4.3.3)
|
||||
showtextdb 3.0 2020-06-04 [1] CRAN (R 4.3.3)
|
||||
snakecase 0.11.1 2023-08-27 [1] CRAN (R 4.3.3)
|
||||
SparseM 1.81 2021-02-18 [1] CRAN (R 4.3.1)
|
||||
stringi 1.8.3 2023-12-11 [1] CRAN (R 4.3.2)
|
||||
stringr 1.5.1 2023-11-14 [1] CRAN (R 4.3.3)
|
||||
survival 3.5-8 2024-02-14 [2] CRAN (R 4.3.3)
|
||||
svglite 2.1.3 2023-12-08 [1] CRAN (R 4.3.3)
|
||||
sysfonts 0.8.9 2024-03-02 [1] CRAN (R 4.3.3)
|
||||
systemfonts 1.0.6 2024-03-07 [1] CRAN (R 4.3.3)
|
||||
tibble 3.2.1 2023-03-20 [1] CRAN (R 4.3.3)
|
||||
tidyr * 1.3.1 2024-01-24 [1] CRAN (R 4.3.3)
|
||||
tidyselect 1.2.1 2024-03-11 [1] CRAN (R 4.3.3)
|
||||
tzdb 0.4.0 2023-05-12 [1] CRAN (R 4.3.3)
|
||||
units 0.8-5 2023-11-28 [1] CRAN (R 4.3.3)
|
||||
urlchecker 1.0.1 2021-11-30 [1] CRAN (R 4.3.3)
|
||||
usethis 2.2.3 2024-02-19 [1] CRAN (R 4.3.3)
|
||||
utf8 1.2.4 2023-10-22 [1] CRAN (R 4.3.3)
|
||||
vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.3.3)
|
||||
viridisLite 0.4.2 2023-05-02 [1] CRAN (R 4.3.3)
|
||||
vroom 1.6.5 2023-12-05 [1] CRAN (R 4.3.3)
|
||||
withr 3.0.0 2024-01-16 [1] CRAN (R 4.3.3)
|
||||
xfun 0.43 2024-03-25 [1] CRAN (R 4.3.3)
|
||||
xml2 1.3.6 2023-12-04 [1] CRAN (R 4.3.3)
|
||||
xtable 1.8-4 2019-04-21 [1] CRAN (R 4.3.3)
|
||||
yaml 2.3.8 2023-12-11 [1] CRAN (R 4.3.2)
|
||||
|
||||
[1] C:/Users/belangew/AppData/Local/R/win-library/4.2
|
||||
[2] C:/Program Files/R/R-4.2.1/library
|
||||
[1] C:/Users/belangew/AppData/Local/R/win-library/4.3
|
||||
[2] C:/Program Files/R/R-4.3.3/library
|
||||
|
||||
──────────────────────────────────────────────────────────────────────────────</code></pre>
|
||||
</div>
|
||||
|
@ -1034,7 +1074,7 @@ Environment <span class="glyphicon glyphicon-plus-sign"></span>
|
|||
|
||||
</section>
|
||||
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" role="doc-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent" data-line-spacing="2" role="list">
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" role="doc-bibliography" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent" data-entry-spacing="0" data-line-spacing="2" role="list">
|
||||
<div id="ref-ADA2015" class="csl-entry" role="listitem">
|
||||
American Diabetes Asssociation. (2015). <em>The burden of diabetes in north carolina</em>. <a href="http://main.diabetes.org/dorg/PDFs/Advocacy/burden-of-diabetes/north-carolina.pdf">http://main.diabetes.org/dorg/PDFs/Advocacy/burden-of-diabetes/north-carolina.pdf</a>
|
||||
</div>
|
||||
|
@ -1053,7 +1093,7 @@ Klein, R. J., & Schoenborn, C. A. (2001). Age adjustment using the 2000 proj
|
|||
<div id="ref-Pierannunzi2012" class="csl-entry" role="listitem">
|
||||
Pierannunzi, C., Town, M., Garvin, W., Shaw, F. E., & Balluz, L. (2012). Methodologic changes in the behavioral risk factor surveillance system in 2011 and potential effects on prevalence estimates. <em>Morbidity and Mortality Weekly Report</em>, <em>61</em>(22), 410–413. <a href="https://www.cdc.gov/mmwr/pdf/wk/mm6122.pdf">https://www.cdc.gov/mmwr/pdf/wk/mm6122.pdf</a>
|
||||
</div>
|
||||
</div></section><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div id="quarto-reuse" class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</a></div></div></section><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2020,
|
||||
</div></section><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2020,
|
||||
author = {Belanger, Kyle},
|
||||
title = {Diabetes in {Rural} {North} {Carolina} : {Exploring}
|
||||
{Prevalence} {Trends}},
|
||||
|
@ -1143,10 +1183,27 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
function tippyHover(el, contentFn) {
|
||||
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||||
var mailtoRegex = new RegExp(/^mailto:/);
|
||||
var filterRegex = new RegExp('/' + window.location.host + '/');
|
||||
var isInternal = (href) => {
|
||||
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
|
||||
}
|
||||
// Inspect non-navigation links and adorn them if external
|
||||
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool)');
|
||||
for (var i=0; i<links.length; i++) {
|
||||
const link = links[i];
|
||||
if (!isInternal(link.href)) {
|
||||
// undo the damage that might have been done by quarto-nav.js in the case of
|
||||
// links that we want to consider external
|
||||
if (link.dataset.originalHref !== undefined) {
|
||||
link.href = link.dataset.originalHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
content: contentFn,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
|
@ -1156,8 +1213,17 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start'
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
|
@ -1169,7 +1235,130 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
try { href = new URL(href).hash; } catch {}
|
||||
const id = href.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
return note.innerHTML;
|
||||
if (note) {
|
||||
return note.innerHTML;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
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++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
|
@ -1213,6 +1402,7 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
|
@ -1238,6 +1428,32 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
|
@ -1301,4 +1517,5 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 81 KiB |
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 88 KiB |
|
@ -2,7 +2,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.3.450">
|
||||
<meta name="generator" content="quarto-1.4.553">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
|
@ -47,7 +47,13 @@ ul.task-list li input[type="checkbox"] {
|
|||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 20,
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
|
@ -56,26 +62,28 @@ ul.task-list li input[type="checkbox"] {
|
|||
"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"
|
||||
}
|
||||
}</script>
|
||||
|
||||
<script src="../../site_libs/kePrint-0.0.1/kePrint.js"></script>
|
||||
|
||||
<link href="../../site_libs/lightable-0.0.1/lightable.css" rel="stylesheet">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../styles.css">
|
||||
</head>
|
||||
|
||||
<body class="floating nav-fixed">
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||||
<header id="quarto-header" class="headroom fixed-top quarto-banner">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="../../index.html">
|
||||
<span class="navbar-title">Kyle Belanger</span>
|
||||
</a>
|
||||
|
@ -87,22 +95,22 @@ ul.task-list li input[type="checkbox"] {
|
|||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../blog.html" rel="" target="">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
<a class="nav-link" href="../../blog.html">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../kyle_resume.pdf" rel="" target="">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
<a class="nav-link" href="../../kyle_resume.pdf">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
</li>
|
||||
<li class="nav-item compact">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19" rel="" target=""><i class="bi bi-github" role="img">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19"> <i class="bi bi-github" role="img">
|
||||
</i>
|
||||
<span class="menu-text"></span></a>
|
||||
<span class="menu-text"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
|
@ -138,7 +146,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
|
||||
</header><div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
|
||||
<!-- sidebar -->
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation floating overflow-auto">
|
||||
<nav id="TOC" role="doc-toc" class="toc-active">
|
||||
<h2 id="toc-title">Table of contents</h2>
|
||||
|
||||
|
@ -156,7 +164,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
</ul>
|
||||
</nav>
|
||||
</nav>
|
||||
<div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
|
||||
<div id="quarto-sidebar-glass" class="quarto-sidebar-collapse-item" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item"></div>
|
||||
<!-- margin-sidebar -->
|
||||
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
|
||||
</div>
|
||||
|
@ -166,6 +174,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
|
||||
|
||||
|
||||
|
||||
<section id="abstract" class="level1">
|
||||
<h1>Abstract</h1>
|
||||
<p>This is the second post in the series exploring Diabetes in rural North Carolina. This post will explore the data used for this project, from collection, cleaning, and analysis ready data.</p>
|
||||
|
@ -179,6 +188,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
<hr>
|
||||
<div class="cell">
|
||||
<div class="cell-output-display">
|
||||
<div>
|
||||
<table class="table table-sm table-striped small" data-quarto-postprocess="true">
|
||||
<caption>Data Sources</caption>
|
||||
<thead>
|
||||
|
@ -218,6 +228,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -227,6 +238,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
<p>View greeter script <a href="https://github.com/mmmmtoasty19/nc-diabetes-epidemic-2020/blob/master/manipulation/publish/0-greeter-census-rural-housing.md">here</a></p>
|
||||
<div class="cell">
|
||||
<div class="cell-output-display">
|
||||
<div>
|
||||
<table class="table table-sm table-striped small" data-quarto-postprocess="true">
|
||||
<caption>Rural Housing Data Set</caption>
|
||||
<thead>
|
||||
|
@ -283,6 +295,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -292,6 +305,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
<p>View greeter script <a href="https://github.com/mmmmtoasty19/nc-diabetes-epidemic-2020/blob/master/manipulation/publish/0-greeter-county-rankings-national.md">here</a></p>
|
||||
<div class="cell">
|
||||
<div class="cell-output-display">
|
||||
<div>
|
||||
<table class="table table-sm table-striped small" data-quarto-postprocess="true">
|
||||
<caption>County Health Rankings Sources</caption>
|
||||
<thead>
|
||||
|
@ -338,11 +352,13 @@ ul.task-list li input[type="checkbox"] {
|
|||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="cell">
|
||||
<div class="cell-output-display">
|
||||
<div>
|
||||
<table class="table table-sm table-striped small" data-quarto-postprocess="true">
|
||||
<caption>County Risk Factors Data Set</caption>
|
||||
<thead>
|
||||
|
@ -426,6 +442,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -435,8 +452,8 @@ ul.task-list li input[type="checkbox"] {
|
|||
<p>View greeter script <a href="https://github.com/mmmmtoasty19/nc-diabetes-epidemic-2020/blob/master/manipulation/publish/0-greeter-us-county-population-estimates.md">here</a></p>
|
||||
<div class="cell">
|
||||
<div class="cell-output-display">
|
||||
<div style="border: 1px solid #ddd; padding: 5px; overflow-x: scroll; width:100%; border-bottom: 0;">
|
||||
|
||||
<div>
|
||||
<div style="border: 1px solid #ddd; padding: 5px; overflow-x: scroll; width:100%; ">
|
||||
<table class="table table-sm table-striped small" data-quarto-postprocess="true">
|
||||
<caption>US Population Estimates Data Set</caption>
|
||||
<thead>
|
||||
|
@ -708,16 +725,89 @@ ul.task-list li input[type="checkbox"] {
|
|||
<td style="text-align: right;">2.87</td>
|
||||
<td style="text-align: right;">0.13</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</tbody><tfoot>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left; padding: 0;"><span style="font-style: italic;">Note: </span></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: left;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left; padding: 0;"><sup></sup> Displaying 6 of 565560 rows</td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: left;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
<td style="text-align: right;"></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<span style="font-style: italic;">Note: </span>
|
||||
|
||||
<sup></sup> Displaying 6 of 565560 rows
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -727,6 +817,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
<p>View greeter script <a href="https://github.com/mmmmtoasty19/nc-diabetes-epidemic-2020/blob/master/manipulation/publish/0-greeter-us-diabetes.md">here</a></p>
|
||||
<div class="cell">
|
||||
<div class="cell-output-display">
|
||||
<div>
|
||||
<table class="table table-sm table-striped small" data-quarto-postprocess="true">
|
||||
<caption>US Diabetes Data</caption>
|
||||
<thead>
|
||||
|
@ -785,6 +876,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
@ -799,7 +891,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
|
||||
</section>
|
||||
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div id="quarto-reuse" class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</a></div></div></section><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2020,
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2020,
|
||||
author = {Belanger, Kyle},
|
||||
title = {Diabetes in {Rural} {North} {Carolina} : {Data} {Collection}
|
||||
and {Cleaning}},
|
||||
|
@ -889,10 +981,27 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
function tippyHover(el, contentFn) {
|
||||
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||||
var mailtoRegex = new RegExp(/^mailto:/);
|
||||
var filterRegex = new RegExp('/' + window.location.host + '/');
|
||||
var isInternal = (href) => {
|
||||
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
|
||||
}
|
||||
// Inspect non-navigation links and adorn them if external
|
||||
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool)');
|
||||
for (var i=0; i<links.length; i++) {
|
||||
const link = links[i];
|
||||
if (!isInternal(link.href)) {
|
||||
// undo the damage that might have been done by quarto-nav.js in the case of
|
||||
// links that we want to consider external
|
||||
if (link.dataset.originalHref !== undefined) {
|
||||
link.href = link.dataset.originalHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
content: contentFn,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
|
@ -902,8 +1011,17 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start'
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
|
@ -915,7 +1033,130 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
try { href = new URL(href).hash; } catch {}
|
||||
const id = href.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
return note.innerHTML;
|
||||
if (note) {
|
||||
return note.innerHTML;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
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++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
|
@ -959,6 +1200,7 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
|
@ -984,6 +1226,32 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
|
@ -1047,4 +1315,5 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
|
@ -2,7 +2,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.3.450">
|
||||
<meta name="generator" content="quarto-1.4.553">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
|
@ -24,7 +24,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
}
|
||||
/* CSS for syntax highlighting */
|
||||
pre > code.sourceCode { white-space: pre; position: relative; }
|
||||
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
|
||||
pre > code.sourceCode > span { line-height: 1.25; }
|
||||
pre > code.sourceCode > span:empty { height: 1.2em; }
|
||||
.sourceCode { overflow: visible; }
|
||||
code.sourceCode > span { color: inherit; text-decoration: inherit; }
|
||||
|
@ -81,7 +81,13 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 20,
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
|
@ -90,6 +96,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
"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"
|
||||
|
@ -103,10 +110,10 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<body class="floating nav-fixed">
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||||
<header id="quarto-header" class="headroom fixed-top quarto-banner">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="../../index.html">
|
||||
<span class="navbar-title">Kyle Belanger</span>
|
||||
</a>
|
||||
|
@ -118,22 +125,22 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../blog.html" rel="" target="">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
<a class="nav-link" href="../../blog.html">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../kyle_resume.pdf" rel="" target="">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
<a class="nav-link" href="../../kyle_resume.pdf">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
</li>
|
||||
<li class="nav-item compact">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19" rel="" target=""><i class="bi bi-github" role="img">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19"> <i class="bi bi-github" role="img">
|
||||
</i>
|
||||
<span class="menu-text"></span></a>
|
||||
<span class="menu-text"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
|
@ -178,7 +185,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
</header><div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
|
||||
<!-- sidebar -->
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation floating overflow-auto">
|
||||
<nav id="TOC" role="doc-toc" class="toc-active">
|
||||
<h2 id="toc-title">Table of contents</h2>
|
||||
|
||||
|
@ -195,7 +202,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
</ul>
|
||||
</nav>
|
||||
</nav>
|
||||
<div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
|
||||
<div id="quarto-sidebar-glass" class="quarto-sidebar-collapse-item" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item"></div>
|
||||
<!-- margin-sidebar -->
|
||||
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
|
||||
</div>
|
||||
|
@ -205,6 +212,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
|
||||
|
||||
|
||||
<section id="authors-note" class="level1">
|
||||
<h1>Authors Note</h1>
|
||||
<p>I have since converted this blog to a quarto blog, but am leaving this post up in case anyone finds it useful</p>
|
||||
|
@ -260,7 +268,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<ol>
|
||||
<li id="fn1"><p>Note that as of publishing, code folding is only available in the development version of distill<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
|
||||
</ol>
|
||||
</section><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div id="quarto-reuse" class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</a></div></div></section><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2021,
|
||||
</section><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2021,
|
||||
author = {Belanger, Kyle},
|
||||
title = {Converting {From} {Blogdown} to {Distill}},
|
||||
date = {2021-01-12},
|
||||
|
@ -349,10 +357,27 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
function tippyHover(el, contentFn) {
|
||||
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||||
var mailtoRegex = new RegExp(/^mailto:/);
|
||||
var filterRegex = new RegExp('/' + window.location.host + '/');
|
||||
var isInternal = (href) => {
|
||||
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
|
||||
}
|
||||
// Inspect non-navigation links and adorn them if external
|
||||
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool)');
|
||||
for (var i=0; i<links.length; i++) {
|
||||
const link = links[i];
|
||||
if (!isInternal(link.href)) {
|
||||
// undo the damage that might have been done by quarto-nav.js in the case of
|
||||
// links that we want to consider external
|
||||
if (link.dataset.originalHref !== undefined) {
|
||||
link.href = link.dataset.originalHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
content: contentFn,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
|
@ -362,8 +387,17 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start'
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
|
@ -375,7 +409,130 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
try { href = new URL(href).hash; } catch {}
|
||||
const id = href.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
return note.innerHTML;
|
||||
if (note) {
|
||||
return note.innerHTML;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
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++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
|
@ -419,6 +576,7 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
|
@ -444,6 +602,32 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
|
@ -507,4 +691,5 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
|
@ -2,7 +2,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.3.450">
|
||||
<meta name="generator" content="quarto-1.4.553">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
|
@ -24,7 +24,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
}
|
||||
/* CSS for syntax highlighting */
|
||||
pre > code.sourceCode { white-space: pre; position: relative; }
|
||||
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
|
||||
pre > code.sourceCode > span { line-height: 1.25; }
|
||||
pre > code.sourceCode > span:empty { height: 1.2em; }
|
||||
.sourceCode { overflow: visible; }
|
||||
code.sourceCode > span { color: inherit; text-decoration: inherit; }
|
||||
|
@ -81,7 +81,13 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 20,
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
|
@ -90,6 +96,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
"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"
|
||||
|
@ -103,10 +110,10 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<body class="floating nav-fixed">
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||||
<header id="quarto-header" class="headroom fixed-top quarto-banner">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="../../index.html">
|
||||
<span class="navbar-title">Kyle Belanger</span>
|
||||
</a>
|
||||
|
@ -118,22 +125,22 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../blog.html" rel="" target="">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
<a class="nav-link" href="../../blog.html">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../kyle_resume.pdf" rel="" target="">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
<a class="nav-link" href="../../kyle_resume.pdf">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
</li>
|
||||
<li class="nav-item compact">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19" rel="" target=""><i class="bi bi-github" role="img">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19"> <i class="bi bi-github" role="img">
|
||||
</i>
|
||||
<span class="menu-text"></span></a>
|
||||
<span class="menu-text"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
|
@ -172,7 +179,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
</header><div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
|
||||
<!-- sidebar -->
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation floating overflow-auto">
|
||||
<nav id="TOC" role="doc-toc" class="toc-active">
|
||||
<h2 id="toc-title">Table of contents</h2>
|
||||
|
||||
|
@ -184,7 +191,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
</ul>
|
||||
</nav>
|
||||
</nav>
|
||||
<div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
|
||||
<div id="quarto-sidebar-glass" class="quarto-sidebar-collapse-item" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item"></div>
|
||||
<!-- margin-sidebar -->
|
||||
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
|
||||
</div>
|
||||
|
@ -194,6 +201,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
|
||||
|
||||
|
||||
<section id="introduction" class="level1">
|
||||
<h1>Introduction</h1>
|
||||
<p>Recently I was struggling to find a data project to work on, I felt a bit stuck with some of my current projects, so I begun to scour the internet to find something to work on. I stumbled upon (TidyTuesday)[https://github.com/rfordatascience/tidytuesday] a weekly project where untidy data is posted from various sources, for the goal of practicing cleaning and visualizing. There is not right or wrong answers for TidyTuesday, this was exactly what I was looking for! This week (well by the time this was posted, a few weeks ago) the data set was about Historically Black Colleges and Universities. Within the posted data there were a few different data sets, I chose to work with the set dealing with High school Graduation rates, throughout this post I will explain my steps for cleaning and then present a few different graphs. It should also be noted that in the first section my code blocks will build upon themselves, so the same code will be duplicated as I add more steps to it.</p>
|
||||
|
@ -350,7 +358,11 @@ $ `Standard Errors - Two or more race` <chr>
|
|||
<span id="cb11-29"><a href="#cb11-29" aria-hidden="true" tabindex="-1"></a> </span>
|
||||
<span id="cb11-30"><a href="#cb11-30" aria-hidden="true" tabindex="-1"></a>g1</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="tidytuesday-2021-week-6-hbcu-enrolment_files/figure-html/unnamed-chunk-10-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="tidytuesday-2021-week-6-hbcu-enrolment_files/figure-html/unnamed-chunk-10-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -469,7 +481,11 @@ $ `Standard Errors - Two or more race` <chr>
|
|||
<span id="cb15-23"><a href="#cb15-23" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb15-24"><a href="#cb15-24" aria-hidden="true" tabindex="-1"></a>g2</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="tidytuesday-2021-week-6-hbcu-enrolment_files/figure-html/unnamed-chunk-14-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="tidytuesday-2021-week-6-hbcu-enrolment_files/figure-html/unnamed-chunk-14-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>Now I am going to graph by Sex and Race.</p>
|
||||
|
@ -508,7 +524,11 @@ $ `Standard Errors - Two or more race` <chr>
|
|||
<span id="cb16-32"><a href="#cb16-32" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb16-33"><a href="#cb16-33" aria-hidden="true" tabindex="-1"></a>g2</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="tidytuesday-2021-week-6-hbcu-enrolment_files/figure-html/unnamed-chunk-15-1.png" class="img-fluid" width="672"></p>
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="tidytuesday-2021-week-6-hbcu-enrolment_files/figure-html/unnamed-chunk-15-1.png" class="img-fluid figure-img" width="672"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -519,7 +539,7 @@ $ `Standard Errors - Two or more race` <chr>
|
|||
|
||||
</section>
|
||||
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div id="quarto-reuse" class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</a></div></div></section><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2021,
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2021,
|
||||
author = {Belanger, Kyle},
|
||||
title = {TidyTuesday 2021 {Week} 6: {HBCU} {Enrollment}},
|
||||
date = {2021-02-26},
|
||||
|
@ -608,10 +628,27 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
function tippyHover(el, contentFn) {
|
||||
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||||
var mailtoRegex = new RegExp(/^mailto:/);
|
||||
var filterRegex = new RegExp('/' + window.location.host + '/');
|
||||
var isInternal = (href) => {
|
||||
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
|
||||
}
|
||||
// Inspect non-navigation links and adorn them if external
|
||||
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool)');
|
||||
for (var i=0; i<links.length; i++) {
|
||||
const link = links[i];
|
||||
if (!isInternal(link.href)) {
|
||||
// undo the damage that might have been done by quarto-nav.js in the case of
|
||||
// links that we want to consider external
|
||||
if (link.dataset.originalHref !== undefined) {
|
||||
link.href = link.dataset.originalHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
content: contentFn,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
|
@ -621,8 +658,17 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start'
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
|
@ -634,7 +680,130 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
try { href = new URL(href).hash; } catch {}
|
||||
const id = href.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
return note.innerHTML;
|
||||
if (note) {
|
||||
return note.innerHTML;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
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++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
|
@ -678,6 +847,7 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
|
@ -703,6 +873,32 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
|
@ -766,4 +962,5 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
|
@ -2,7 +2,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.3.450">
|
||||
<meta name="generator" content="quarto-1.4.553">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
|
@ -47,7 +47,13 @@ ul.task-list li input[type="checkbox"] {
|
|||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 20,
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
|
@ -56,6 +62,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
"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"
|
||||
|
@ -69,10 +76,10 @@ ul.task-list li input[type="checkbox"] {
|
|||
<body class="floating nav-fixed">
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||||
<header id="quarto-header" class="headroom fixed-top quarto-banner">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="../../index.html">
|
||||
<span class="navbar-title">Kyle Belanger</span>
|
||||
</a>
|
||||
|
@ -84,22 +91,22 @@ ul.task-list li input[type="checkbox"] {
|
|||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../blog.html" rel="" target="">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
<a class="nav-link" href="../../blog.html">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../kyle_resume.pdf" rel="" target="">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
<a class="nav-link" href="../../kyle_resume.pdf">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
</li>
|
||||
<li class="nav-item compact">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19" rel="" target=""><i class="bi bi-github" role="img">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19"> <i class="bi bi-github" role="img">
|
||||
</i>
|
||||
<span class="menu-text"></span></a>
|
||||
<span class="menu-text"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
|
@ -135,10 +142,10 @@ ul.task-list li input[type="checkbox"] {
|
|||
|
||||
</header><div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
|
||||
<!-- sidebar -->
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation floating overflow-auto">
|
||||
|
||||
</nav>
|
||||
<div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
|
||||
<div id="quarto-sidebar-glass" class="quarto-sidebar-collapse-item" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item"></div>
|
||||
<!-- margin-sidebar -->
|
||||
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
|
||||
</div>
|
||||
|
@ -148,12 +155,13 @@ ul.task-list li input[type="checkbox"] {
|
|||
|
||||
|
||||
|
||||
|
||||
<p>Distill is a publication format for scientific and technical writing, native to the web.</p>
|
||||
<p>Learn more about using Distill at <a href="https://rstudio.github.io/distill" class="uri">https://rstudio.github.io/distill</a>.</p>
|
||||
|
||||
|
||||
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div id="quarto-reuse" class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</a></div></div></section><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2022,
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2022,
|
||||
author = {Belanger, Kyle},
|
||||
title = {Making {Maps} in {R}},
|
||||
date = {2022-07-28},
|
||||
|
@ -241,10 +249,27 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
function tippyHover(el, contentFn) {
|
||||
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||||
var mailtoRegex = new RegExp(/^mailto:/);
|
||||
var filterRegex = new RegExp('/' + window.location.host + '/');
|
||||
var isInternal = (href) => {
|
||||
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
|
||||
}
|
||||
// Inspect non-navigation links and adorn them if external
|
||||
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool)');
|
||||
for (var i=0; i<links.length; i++) {
|
||||
const link = links[i];
|
||||
if (!isInternal(link.href)) {
|
||||
// undo the damage that might have been done by quarto-nav.js in the case of
|
||||
// links that we want to consider external
|
||||
if (link.dataset.originalHref !== undefined) {
|
||||
link.href = link.dataset.originalHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
content: contentFn,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
|
@ -254,8 +279,17 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start'
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
|
@ -267,7 +301,130 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
try { href = new URL(href).hash; } catch {}
|
||||
const id = href.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
return note.innerHTML;
|
||||
if (note) {
|
||||
return note.innerHTML;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
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++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
|
@ -311,6 +468,7 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
|
@ -336,6 +494,32 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
|
@ -399,4 +583,5 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
|
@ -2,7 +2,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="quarto-1.3.450">
|
||||
<meta name="generator" content="quarto-1.4.553">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
|
@ -47,7 +47,13 @@ ul.task-list li input[type="checkbox"] {
|
|||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 20,
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
|
@ -56,6 +62,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
"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"
|
||||
|
@ -69,10 +76,10 @@ ul.task-list li input[type="checkbox"] {
|
|||
<body class="floating nav-fixed">
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||||
<header id="quarto-header" class="headroom fixed-top quarto-banner">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="../../index.html">
|
||||
<span class="navbar-title">Kyle Belanger</span>
|
||||
</a>
|
||||
|
@ -84,22 +91,22 @@ ul.task-list li input[type="checkbox"] {
|
|||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../blog.html" rel="" target="">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
<a class="nav-link" href="../../blog.html">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../kyle_resume.pdf" rel="" target="">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
<a class="nav-link" href="../../kyle_resume.pdf">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
</li>
|
||||
<li class="nav-item compact">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19" rel="" target=""><i class="bi bi-github" role="img">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19"> <i class="bi bi-github" role="img">
|
||||
</i>
|
||||
<span class="menu-text"></span></a>
|
||||
<span class="menu-text"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
|
@ -135,7 +142,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
|
||||
</header><div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
|
||||
<!-- sidebar -->
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation floating overflow-auto">
|
||||
<nav id="TOC" role="doc-toc" class="toc-active">
|
||||
<h2 id="toc-title">Table of contents</h2>
|
||||
|
||||
|
@ -145,7 +152,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
</ul>
|
||||
</nav>
|
||||
</nav>
|
||||
<div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
|
||||
<div id="quarto-sidebar-glass" class="quarto-sidebar-collapse-item" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item"></div>
|
||||
<!-- margin-sidebar -->
|
||||
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
|
||||
</div>
|
||||
|
@ -155,6 +162,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
|
||||
|
||||
|
||||
|
||||
<section id="full-paper" class="level1">
|
||||
<h1>Full Paper</h1>
|
||||
<p>To view the full paper please go to the following <a href="https://kyle-belanger.quarto.pub/reflex-testing-using-machine-learning-in-the-clinical-laboratory/">link</a></p>
|
||||
|
@ -169,7 +177,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
|
||||
</section>
|
||||
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div id="quarto-reuse" class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</a></div></div></section><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2023,
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2023,
|
||||
author = {Belanger, Kyle},
|
||||
title = {Reflex {Testing} Using {Machine} {Learning} in the {Clinical}
|
||||
{Laboratory}},
|
||||
|
@ -259,10 +267,27 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
function tippyHover(el, contentFn) {
|
||||
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||||
var mailtoRegex = new RegExp(/^mailto:/);
|
||||
var filterRegex = new RegExp('/' + window.location.host + '/');
|
||||
var isInternal = (href) => {
|
||||
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
|
||||
}
|
||||
// Inspect non-navigation links and adorn them if external
|
||||
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool)');
|
||||
for (var i=0; i<links.length; i++) {
|
||||
const link = links[i];
|
||||
if (!isInternal(link.href)) {
|
||||
// undo the damage that might have been done by quarto-nav.js in the case of
|
||||
// links that we want to consider external
|
||||
if (link.dataset.originalHref !== undefined) {
|
||||
link.href = link.dataset.originalHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
content: contentFn,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
|
@ -272,8 +297,17 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start'
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
|
@ -285,7 +319,130 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
try { href = new URL(href).hash; } catch {}
|
||||
const id = href.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
return note.innerHTML;
|
||||
if (note) {
|
||||
return note.innerHTML;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
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++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
|
@ -329,6 +486,7 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
|
@ -354,6 +512,32 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
|
@ -417,4 +601,5 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
943
_site/posts/2024-05-15-US-NHL-Birthrate/index.html
Normal file
|
@ -0,0 +1,943 @@
|
|||
<!DOCTYPE html>
|
||||
<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.553">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
<meta name="author" content="Kyle Belanger">
|
||||
<meta name="dcterms.date" content="2024-06-08">
|
||||
<meta name="description" content="Inspired by TidyTuesday Week 2 - 2024 dataset about Candian Players, lets look at the same anaylyis for American Born Players">
|
||||
|
||||
<title>Kyle Belanger - Does a US Born Players Birthdate affect their shot at the NHL</title>
|
||||
<style>
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
div.columns{display: flex; gap: min(4vw, 1.5em);}
|
||||
div.column{flex: auto; overflow-x: auto;}
|
||||
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
||||
ul.task-list{list-style: none;}
|
||||
ul.task-list li input[type="checkbox"] {
|
||||
width: 0.8em;
|
||||
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
|
||||
vertical-align: middle;
|
||||
}
|
||||
/* CSS for syntax highlighting */
|
||||
pre > code.sourceCode { white-space: pre; position: relative; }
|
||||
pre > code.sourceCode > span { line-height: 1.25; }
|
||||
pre > code.sourceCode > span:empty { height: 1.2em; }
|
||||
.sourceCode { overflow: visible; }
|
||||
code.sourceCode > span { color: inherit; text-decoration: inherit; }
|
||||
div.sourceCode { margin: 1em 0; }
|
||||
pre.sourceCode { margin: 0; }
|
||||
@media screen {
|
||||
div.sourceCode { overflow: auto; }
|
||||
}
|
||||
@media print {
|
||||
pre > code.sourceCode { white-space: pre-wrap; }
|
||||
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
|
||||
}
|
||||
pre.numberSource code
|
||||
{ counter-reset: source-line 0; }
|
||||
pre.numberSource code > span
|
||||
{ position: relative; left: -4em; counter-increment: source-line; }
|
||||
pre.numberSource code > span > a:first-child::before
|
||||
{ content: counter(source-line);
|
||||
position: relative; left: -1em; text-align: right; vertical-align: baseline;
|
||||
border: none; display: inline-block;
|
||||
-webkit-touch-callout: none; -webkit-user-select: none;
|
||||
-khtml-user-select: none; -moz-user-select: none;
|
||||
-ms-user-select: none; user-select: none;
|
||||
padding: 0 4px; width: 4em;
|
||||
}
|
||||
pre.numberSource { margin-left: 3em; padding-left: 4px; }
|
||||
div.sourceCode
|
||||
{ }
|
||||
@media screen {
|
||||
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<script src="../../site_libs/quarto-nav/quarto-nav.js"></script>
|
||||
<script src="../../site_libs/quarto-nav/headroom.min.js"></script>
|
||||
<script src="../../site_libs/clipboard/clipboard.min.js"></script>
|
||||
<script src="../../site_libs/quarto-search/autocomplete.umd.js"></script>
|
||||
<script src="../../site_libs/quarto-search/fuse.min.js"></script>
|
||||
<script src="../../site_libs/quarto-search/quarto-search.js"></script>
|
||||
<meta name="quarto:offset" content="../../">
|
||||
<script src="../../site_libs/quarto-html/quarto.js"></script>
|
||||
<script src="../../site_libs/quarto-html/popper.min.js"></script>
|
||||
<script src="../../site_libs/quarto-html/tippy.umd.min.js"></script>
|
||||
<script src="../../site_libs/quarto-html/anchor.min.js"></script>
|
||||
<link href="../../site_libs/quarto-html/tippy.css" rel="stylesheet">
|
||||
<link href="../../site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
|
||||
<script src="../../site_libs/bootstrap/bootstrap.min.js"></script>
|
||||
<link href="../../site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
|
||||
<link href="../../site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
|
||||
<script id="quarto-search-options" type="application/json">{
|
||||
"location": "navbar",
|
||||
"copy-button": false,
|
||||
"collapse-after": 3,
|
||||
"panel-placement": "end",
|
||||
"type": "overlay",
|
||||
"limit": 50,
|
||||
"keyboard-shortcut": [
|
||||
"f",
|
||||
"/",
|
||||
"s"
|
||||
],
|
||||
"show-item-context": false,
|
||||
"language": {
|
||||
"search-no-results-text": "No results",
|
||||
"search-matching-documents-text": "matching documents",
|
||||
"search-copy-link-title": "Copy link to search",
|
||||
"search-hide-matches-text": "Hide additional matches",
|
||||
"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"
|
||||
}
|
||||
}</script>
|
||||
<script src="../../site_libs/kePrint-0.0.1/kePrint.js"></script>
|
||||
|
||||
<link href="../../site_libs/lightable-0.0.1/lightable.css" rel="stylesheet">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../styles.css">
|
||||
</head>
|
||||
|
||||
<body class="floating nav-fixed">
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top quarto-banner">
|
||||
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
|
||||
<div class="navbar-container container-fluid">
|
||||
<div class="navbar-brand-container mx-auto">
|
||||
<a class="navbar-brand" href="../../index.html">
|
||||
<span class="navbar-title">Kyle Belanger</span>
|
||||
</a>
|
||||
</div>
|
||||
<div id="quarto-search" class="" title="Search"></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(); }">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav navbar-nav-scroll ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../blog.html">
|
||||
<span class="menu-text">Posts</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../../kyle_resume.pdf">
|
||||
<span class="menu-text">Resume</span></a>
|
||||
</li>
|
||||
<li class="nav-item compact">
|
||||
<a class="nav-link" href="https://github.com/mmmmtoasty19"> <i class="bi bi-github" role="img">
|
||||
</i>
|
||||
<span class="menu-text"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div> <!-- /navcollapse -->
|
||||
<div class="quarto-navbar-tools">
|
||||
</div>
|
||||
</div> <!-- /container-fluid -->
|
||||
</nav>
|
||||
</header>
|
||||
<!-- content -->
|
||||
<header id="title-block-header" class="quarto-title-block default toc-left page-columns page-full">
|
||||
<div class="quarto-title-banner page-columns page-full">
|
||||
<div class="quarto-title column-body">
|
||||
<h1 class="title">Does a US Born Players Birthdate affect their shot at the NHL</h1>
|
||||
<div>
|
||||
<div class="description">
|
||||
Inspired by TidyTuesday Week 2 - 2024 dataset about Candian Players, lets look at the same anaylyis for American Born Players
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-categories">
|
||||
<div class="quarto-category">tidytuesday</div>
|
||||
<div class="quarto-category">R</div>
|
||||
<div class="quarto-category">dataViz</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="quarto-title-meta">
|
||||
|
||||
<div>
|
||||
<div class="quarto-title-meta-heading">Author</div>
|
||||
<div class="quarto-title-meta-contents">
|
||||
<p><a href="https://kyleb.rbind.io/">Kyle Belanger</a> </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="quarto-title-meta-heading">Published</div>
|
||||
<div class="quarto-title-meta-contents">
|
||||
<p class="date">June 8, 2024</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</header><div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
|
||||
<!-- sidebar -->
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation floating overflow-auto">
|
||||
<nav id="TOC" role="doc-toc" class="toc-active">
|
||||
<h2 id="toc-title">Table of contents</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="#distribution-of-births-by-month-in-the-united-states" id="toc-distribution-of-births-by-month-in-the-united-states" class="nav-link active" data-scroll-target="#distribution-of-births-by-month-in-the-united-states">Distribution of Births by Month in the United States</a>
|
||||
<ul class="collapse">
|
||||
<li><a href="#distribution-of-births-compared-to-expected" id="toc-distribution-of-births-compared-to-expected" class="nav-link" data-scroll-target="#distribution-of-births-compared-to-expected">Distribution of Births Compared to Expected</a></li>
|
||||
</ul></li>
|
||||
<li><a href="#hockey-data" id="toc-hockey-data" class="nav-link" data-scroll-target="#hockey-data">Hockey Data</a></li>
|
||||
<li><a href="#graph-it" id="toc-graph-it" class="nav-link" data-scroll-target="#graph-it">Graph It</a></li>
|
||||
<li><a href="#a-little-fun" id="toc-a-little-fun" class="nav-link" data-scroll-target="#a-little-fun">A Little Fun</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</nav>
|
||||
<div id="quarto-sidebar-glass" class="quarto-sidebar-collapse-item" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item"></div>
|
||||
<!-- margin-sidebar -->
|
||||
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
|
||||
</div>
|
||||
<!-- main -->
|
||||
<main class="content quarto-banner-title-block" id="quarto-document-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p>This post is inspired by this fantastic <a href="https://jlaw.netlify.app/2023/12/04/are-birth-dates-still-destiny-for-canadian-nhl-players/">blog post</a> on Jlaws Blog. In it they explore how in the first chapter Malcolm Gladwell’s Outliers he discusses how in Canadian Junior Hockey there is a higher likelihood for players to be born in the first quarter of the year. As it appears cutoff dates for USA hockey are different and they are currently using June 1st (if my internet searches are to be believed), I wondered if the same analysis would hold true for American Born Players.</p>
|
||||
<section id="distribution-of-births-by-month-in-the-united-states" class="level2">
|
||||
<h2 class="anchored" data-anchor-id="distribution-of-births-by-month-in-the-united-states">Distribution of Births by Month in the United States</h2>
|
||||
<p>The data for US Birth Rates can be pulled from <a href="https://wonder.cdc.gov/">CDC Wonder</a>. The particular table of interest is the Natality, 2007 - 2022. CDC Wonder has a quite interesting API that requires a request with quite a few XML parameters. Thankfully you can build the request on the website and a nice package already exists to send the query. Check out the <a href="https://socdatar.github.io/wonderapi/index.html">Wonderapi Page</a> for more info.</p>
|
||||
<div class="cell">
|
||||
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>usa_raw <span class="ot"><-</span> wonderapi<span class="sc">::</span><span class="fu">send_query</span>(<span class="st">"D66"</span>, here<span class="sc">::</span><span class="fu">here</span>(<span class="st">"posts"</span>, <span class="st">"2024-05-15-US-NHL-Birthrate"</span>, <span class="st">"cdc_wonder_request.xml"</span>))</span>
|
||||
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a>usa_births <span class="ot"><-</span> usa_raw <span class="sc">%>%</span></span>
|
||||
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">group_by</span>(Month) <span class="sc">%>%</span></span>
|
||||
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">summarise</span>(<span class="at">country_births =</span> <span class="fu">sum</span>(Births), <span class="at">.groups =</span> <span class="st">"drop"</span>) <span class="sc">%>%</span></span>
|
||||
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">country_pct =</span> country_births <span class="sc">/</span> <span class="fu">sum</span>(country_births))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
</div>
|
||||
<section id="distribution-of-births-compared-to-expected" class="level3">
|
||||
<h3 class="anchored" data-anchor-id="distribution-of-births-compared-to-expected">Distribution of Births Compared to Expected</h3>
|
||||
<p>The data from CDC Wonder pulls in quite nice, the only addition is adding a column for expected Births. This column gives each day of each month an equal chance for a person being born. Based on the data the summer months (June through August), and September have a slightly higher actual birth vs expected. Based on cut off Dates many of these kids would be the oldest in their age groups.</p>
|
||||
<div class="cell">
|
||||
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>usa_births <span class="sc">%>%</span></span>
|
||||
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">expected_births =</span> dplyr<span class="sc">::</span><span class="fu">case_when</span>(</span>
|
||||
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> Month <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"April"</span>, <span class="st">"June"</span>, <span class="st">"September"</span>, <span class="st">"November"</span>) <span class="sc">~</span> <span class="dv">30</span> <span class="sc">/</span> <span class="dv">365</span></span>
|
||||
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> , Month <span class="sc">==</span> <span class="st">"February"</span> <span class="sc">~</span> <span class="dv">28</span> <span class="sc">/</span> <span class="dv">365</span></span>
|
||||
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> , <span class="at">.default =</span> <span class="dv">31</span> <span class="sc">/</span> <span class="dv">365</span></span>
|
||||
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a> )</span>
|
||||
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a> , <span class="at">difference =</span> country_pct <span class="sc">-</span> expected_births</span>
|
||||
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a> , dplyr<span class="sc">::</span><span class="fu">across</span>(Month, <span class="sc">~</span><span class="fu">factor</span>(., <span class="at">levels =</span> month.name))</span>
|
||||
<span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a> , dplyr<span class="sc">::</span><span class="fu">across</span>(<span class="fu">c</span>(country_pct, expected_births, difference), <span class="sc">~</span>scales<span class="sc">::</span><span class="fu">percent</span>(., <span class="at">accuracy =</span> .<span class="dv">1</span>))</span>
|
||||
<span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">%>%</span></span>
|
||||
<span id="cb2-11"><a href="#cb2-11" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">arrange</span>(Month) <span class="sc">%>%</span></span>
|
||||
<span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">rename_with</span>(<span class="sc">~</span>stringr<span class="sc">::</span><span class="fu">str_replace_all</span>(., <span class="st">"_"</span>, <span class="st">" "</span>)) <span class="sc">%>%</span></span>
|
||||
<span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">rename_with</span>(stringr<span class="sc">::</span>str_to_title) <span class="sc">%>%</span></span>
|
||||
<span id="cb2-14"><a href="#cb2-14" aria-hidden="true" tabindex="-1"></a> kableExtra<span class="sc">::</span><span class="fu">kbl</span>() <span class="sc">%>%</span></span>
|
||||
<span id="cb2-15"><a href="#cb2-15" aria-hidden="true" tabindex="-1"></a> kableExtra<span class="sc">::</span><span class="fu">kable_styling</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<div>
|
||||
<table class="table table-sm table-striped small" data-quarto-postprocess="true">
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th style="text-align: left;" data-quarto-table-cell-role="th">Month</th>
|
||||
<th style="text-align: right;" data-quarto-table-cell-role="th">Country Births</th>
|
||||
<th style="text-align: left;" data-quarto-table-cell-role="th">Country Pct</th>
|
||||
<th style="text-align: left;" data-quarto-table-cell-role="th">Expected Births</th>
|
||||
<th style="text-align: left;" data-quarto-table-cell-role="th">Difference</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">January</td>
|
||||
<td style="text-align: right;">5118343</td>
|
||||
<td style="text-align: left;">8.2%</td>
|
||||
<td style="text-align: left;">8.5%</td>
|
||||
<td style="text-align: left;">-0.3%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">February</td>
|
||||
<td style="text-align: right;">4758741</td>
|
||||
<td style="text-align: left;">7.6%</td>
|
||||
<td style="text-align: left;">7.7%</td>
|
||||
<td style="text-align: left;">-0.1%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">March</td>
|
||||
<td style="text-align: right;">5205579</td>
|
||||
<td style="text-align: left;">8.3%</td>
|
||||
<td style="text-align: left;">8.5%</td>
|
||||
<td style="text-align: left;">-0.2%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">April</td>
|
||||
<td style="text-align: right;">5001651</td>
|
||||
<td style="text-align: left;">8.0%</td>
|
||||
<td style="text-align: left;">8.2%</td>
|
||||
<td style="text-align: left;">-0.3%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">May</td>
|
||||
<td style="text-align: right;">5226642</td>
|
||||
<td style="text-align: left;">8.3%</td>
|
||||
<td style="text-align: left;">8.5%</td>
|
||||
<td style="text-align: left;">-0.2%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">June</td>
|
||||
<td style="text-align: right;">5226141</td>
|
||||
<td style="text-align: left;">8.3%</td>
|
||||
<td style="text-align: left;">8.2%</td>
|
||||
<td style="text-align: left;">0.1%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">July</td>
|
||||
<td style="text-align: right;">5528731</td>
|
||||
<td style="text-align: left;">8.8%</td>
|
||||
<td style="text-align: left;">8.5%</td>
|
||||
<td style="text-align: left;">0.3%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">August</td>
|
||||
<td style="text-align: right;">5635283</td>
|
||||
<td style="text-align: left;">9.0%</td>
|
||||
<td style="text-align: left;">8.5%</td>
|
||||
<td style="text-align: left;">0.5%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">September</td>
|
||||
<td style="text-align: right;">5448101</td>
|
||||
<td style="text-align: left;">8.7%</td>
|
||||
<td style="text-align: left;">8.2%</td>
|
||||
<td style="text-align: left;">0.5%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">October</td>
|
||||
<td style="text-align: right;">5348495</td>
|
||||
<td style="text-align: left;">8.5%</td>
|
||||
<td style="text-align: left;">8.5%</td>
|
||||
<td style="text-align: left;">0.0%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">November</td>
|
||||
<td style="text-align: right;">5059952</td>
|
||||
<td style="text-align: left;">8.1%</td>
|
||||
<td style="text-align: left;">8.2%</td>
|
||||
<td style="text-align: left;">-0.2%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">December</td>
|
||||
<td style="text-align: right;">5227828</td>
|
||||
<td style="text-align: left;">8.3%</td>
|
||||
<td style="text-align: left;">8.5%</td>
|
||||
<td style="text-align: left;">-0.2%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
<section id="hockey-data" class="level2">
|
||||
<h2 class="anchored" data-anchor-id="hockey-data">Hockey Data</h2>
|
||||
<p>While I wish I could sit and type out how I sat and figured out the complexity of the NHL Stats API and how to bring it into R. In reality I took a great guide, that being Jlaws post, and tweaked what I needed. Instead of Canadian players, I pulled out just the US Born players and their birth dates. I did also pull out positions to see if that will make any sort of difference. What pulls out of the NHL API has a ton of great details and I look forward to diving into what is available to see what kind of graphics can be built.</p>
|
||||
<div class="cell">
|
||||
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>teams <span class="ot"><-</span> httr<span class="sc">::</span><span class="fu">GET</span>(<span class="st">"https://api.nhle.com/stats/rest/en/team"</span>) <span class="sc">%>%</span></span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> httr<span class="sc">::</span><span class="fu">content</span>() <span class="sc">%>%</span></span>
|
||||
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> .[[<span class="st">"data"</span>]] <span class="sc">%>%</span></span>
|
||||
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> tibble<span class="sc">::</span><span class="fu">tibble</span>(<span class="at">data =</span> .) <span class="sc">%>%</span></span>
|
||||
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> tidyr<span class="sc">::</span><span class="fu">unnest_wider</span>(data)</span>
|
||||
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a>get_roster <span class="ot"><-</span> <span class="cf">function</span>(team){</span>
|
||||
<span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a> httr<span class="sc">::</span><span class="fu">GET</span>(glue<span class="sc">::</span><span class="fu">glue</span>(<span class="st">"https://api-web.nhle.com/v1/roster/{team}/20232024"</span>)) <span class="sc">%>%</span></span>
|
||||
<span id="cb3-9"><a href="#cb3-9" aria-hidden="true" tabindex="-1"></a> httr<span class="sc">::</span><span class="fu">content</span>() <span class="sc">%>%</span></span>
|
||||
<span id="cb3-10"><a href="#cb3-10" aria-hidden="true" tabindex="-1"></a> purrr<span class="sc">::</span><span class="fu">flatten</span>() <span class="sc">%>%</span></span>
|
||||
<span id="cb3-11"><a href="#cb3-11" aria-hidden="true" tabindex="-1"></a> tibble<span class="sc">::</span><span class="fu">tibble</span>(<span class="at">data =</span> .) <span class="sc">%>%</span></span>
|
||||
<span id="cb3-12"><a href="#cb3-12" aria-hidden="true" tabindex="-1"></a> tidyr<span class="sc">::</span><span class="fu">hoist</span>(</span>
|
||||
<span id="cb3-13"><a href="#cb3-13" aria-hidden="true" tabindex="-1"></a> <span class="at">.col =</span> <span class="st">"data"</span></span>
|
||||
<span id="cb3-14"><a href="#cb3-14" aria-hidden="true" tabindex="-1"></a> , <span class="st">"firstName"</span> <span class="ot">=</span> <span class="fu">list</span>(<span class="st">"firstName"</span>, <span class="dv">1</span>L)</span>
|
||||
<span id="cb3-15"><a href="#cb3-15" aria-hidden="true" tabindex="-1"></a> , <span class="st">"lastName"</span> <span class="ot">=</span> <span class="fu">list</span>(<span class="st">"lastName"</span>, <span class="dv">1</span>L)</span>
|
||||
<span id="cb3-16"><a href="#cb3-16" aria-hidden="true" tabindex="-1"></a> , <span class="st">"positionCode"</span></span>
|
||||
<span id="cb3-17"><a href="#cb3-17" aria-hidden="true" tabindex="-1"></a> , <span class="st">"birthDate"</span></span>
|
||||
<span id="cb3-18"><a href="#cb3-18" aria-hidden="true" tabindex="-1"></a> , <span class="st">"birthCountry"</span></span>
|
||||
<span id="cb3-19"><a href="#cb3-19" aria-hidden="true" tabindex="-1"></a> )</span>
|
||||
<span id="cb3-20"><a href="#cb3-20" aria-hidden="true" tabindex="-1"></a>}</span>
|
||||
<span id="cb3-21"><a href="#cb3-21" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb3-22"><a href="#cb3-22" aria-hidden="true" tabindex="-1"></a>usa_roster <span class="ot"><-</span> purrr<span class="sc">::</span><span class="fu">map</span>(teams<span class="sc">$</span>triCode, get_roster) <span class="sc">%>%</span></span>
|
||||
<span id="cb3-23"><a href="#cb3-23" aria-hidden="true" tabindex="-1"></a> purrr<span class="sc">::</span><span class="fu">list_rbind</span>() <span class="sc">%>%</span></span>
|
||||
<span id="cb3-24"><a href="#cb3-24" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(<span class="sc">!</span><span class="fu">is.na</span>(firstName)) <span class="sc">%>%</span></span>
|
||||
<span id="cb3-25"><a href="#cb3-25" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(birthCountry <span class="sc">==</span> <span class="st">"USA"</span>) <span class="sc">%>%</span></span>
|
||||
<span id="cb3-26"><a href="#cb3-26" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">mutate</span>(</span>
|
||||
<span id="cb3-27"><a href="#cb3-27" aria-hidden="true" tabindex="-1"></a> <span class="at">mob =</span> lubridate<span class="sc">::</span><span class="fu">month</span>(lubridate<span class="sc">::</span><span class="fu">ymd</span>(birthDate), <span class="at">label =</span> <span class="cn">TRUE</span>, <span class="at">abbr =</span> <span class="cn">FALSE</span>)</span>
|
||||
<span id="cb3-28"><a href="#cb3-28" aria-hidden="true" tabindex="-1"></a> , <span class="at">mob_id =</span> lubridate<span class="sc">::</span><span class="fu">month</span>(lubridate<span class="sc">::</span><span class="fu">ymd</span>(birthDate))</span>
|
||||
<span id="cb3-29"><a href="#cb3-29" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">%>%</span></span>
|
||||
<span id="cb3-30"><a href="#cb3-30" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">count</span>(mob_id, mob, <span class="at">name =</span> <span class="st">"players"</span>) <span class="sc">%>%</span></span>
|
||||
<span id="cb3-31"><a href="#cb3-31" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">player_pct =</span> players <span class="sc">/</span> <span class="fu">sum</span>(players))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="graph-it" class="level2">
|
||||
<h2 class="anchored" data-anchor-id="graph-it">Graph It</h2>
|
||||
<p>Lets now take a look at the graph. Using the ggimage package we can place nice logos for both the United States and NHL on the graph. This stands out quite nicely versus just using a colored point. Interesting enough the graph seems to show being born early on in the year may mean making the NHL is more likely.</p>
|
||||
<div class="cell">
|
||||
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>nhl_icon <span class="ot"><-</span> <span class="st">"https://pbs.twimg.com/media/F9sTTAYakAAkRv6.png"</span></span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a>usa_icon <span class="ot"><-</span> <span class="st">"https://cdn-icons-png.flaticon.com/512/197/197484.png"</span></span>
|
||||
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a>combined <span class="ot"><-</span> usa_roster <span class="sc">%>%</span></span>
|
||||
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">left_join</span>(usa_births, <span class="at">by =</span> <span class="fu">c</span>(<span class="st">"mob"</span> <span class="ot">=</span> <span class="st">"Month"</span>)) <span class="sc">%>%</span></span>
|
||||
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">mutate</span>(</span>
|
||||
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="at">random =</span> dplyr<span class="sc">::</span><span class="fu">case_when</span>(</span>
|
||||
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> mob_id <span class="sc">%in%</span> <span class="fu">c</span>(<span class="dv">4</span>, <span class="dv">6</span>, <span class="dv">9</span>, <span class="dv">11</span>) <span class="sc">~</span> <span class="dv">30</span> <span class="sc">/</span> <span class="dv">365</span>,</span>
|
||||
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a> mob_id <span class="sc">%in%</span> <span class="fu">c</span>(<span class="dv">1</span>, <span class="dv">3</span>, <span class="dv">5</span>, <span class="dv">7</span>, <span class="dv">8</span>, <span class="dv">10</span>, <span class="dv">12</span>) <span class="sc">~</span> <span class="dv">31</span> <span class="sc">/</span> <span class="dv">365</span>,</span>
|
||||
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a> mob_id <span class="sc">==</span> <span class="dv">2</span> <span class="sc">~</span> <span class="dv">28</span> <span class="sc">/</span> <span class="dv">365</span></span>
|
||||
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a> )</span>
|
||||
<span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a> )</span>
|
||||
<span id="cb4-13"><a href="#cb4-13" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb4-14"><a href="#cb4-14" aria-hidden="true" tabindex="-1"></a><span class="co"># labels <- combined %>% glue::glue_data("{mob} <br> n = {players}")</span></span>
|
||||
<span id="cb4-15"><a href="#cb4-15" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb4-16"><a href="#cb4-16" aria-hidden="true" tabindex="-1"></a>g1 <span class="ot"><-</span> combined <span class="sc">%>%</span></span>
|
||||
<span id="cb4-17"><a href="#cb4-17" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x =</span> forcats<span class="sc">::</span><span class="fu">fct_reorder</span>(mob, <span class="sc">-</span>mob_id))) <span class="sc">+</span></span>
|
||||
<span id="cb4-18"><a href="#cb4-18" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_line</span>(<span class="fu">aes</span>(<span class="at">y =</span> random, <span class="at">group =</span> <span class="dv">1</span>), <span class="at">linetype =</span> <span class="dv">2</span>, <span class="at">color =</span> <span class="st">"grey60"</span>) <span class="sc">+</span></span>
|
||||
<span id="cb4-19"><a href="#cb4-19" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_linerange</span>(<span class="fu">aes</span>(<span class="at">ymin =</span> country_pct, <span class="at">ymax =</span> player_pct)) <span class="sc">+</span></span>
|
||||
<span id="cb4-20"><a href="#cb4-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_image</span>(<span class="fu">aes</span>(<span class="at">image =</span> nhl_icon, <span class="at">y =</span> player_pct), <span class="at">size =</span> <span class="fl">0.1</span>) <span class="sc">+</span></span>
|
||||
<span id="cb4-21"><a href="#cb4-21" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_image</span>(<span class="fu">aes</span>(<span class="at">image =</span> usa_icon, <span class="at">y =</span> country_pct), <span class="at">size =</span> <span class="fl">0.08</span>) <span class="sc">+</span></span>
|
||||
<span id="cb4-22"><a href="#cb4-22" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_text</span>(<span class="fu">aes</span>(<span class="at">label =</span> scales<span class="sc">::</span><span class="fu">percent</span>(player_pct, <span class="at">accuracy =</span> .<span class="dv">1</span>),</span>
|
||||
<span id="cb4-23"><a href="#cb4-23" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> dplyr<span class="sc">::</span><span class="fu">if_else</span>(player_pct <span class="sc">></span> country_pct, player_pct <span class="sc">+</span> .<span class="dv">006</span>, player_pct <span class="sc">-</span> .<span class="dv">006</span>)), <span class="at">size =</span> <span class="dv">5</span>) <span class="sc">+</span></span>
|
||||
<span id="cb4-24"><a href="#cb4-24" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_text</span>(<span class="fu">aes</span>(<span class="at">label =</span> scales<span class="sc">::</span><span class="fu">percent</span>(country_pct, <span class="at">accuracy =</span> .<span class="dv">1</span>),</span>
|
||||
<span id="cb4-25"><a href="#cb4-25" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> dplyr<span class="sc">::</span><span class="fu">if_else</span>(country_pct <span class="sc">></span> player_pct, country_pct <span class="sc">+</span> .<span class="dv">006</span>, country_pct <span class="sc">-</span> .<span class="dv">006</span>)), <span class="at">size =</span> <span class="dv">5</span>) <span class="sc">+</span></span>
|
||||
<span id="cb4-26"><a href="#cb4-26" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_y_continuous</span>(<span class="at">labels =</span> scales<span class="sc">::</span>percent) <span class="sc">+</span></span>
|
||||
<span id="cb4-27"><a href="#cb4-27" aria-hidden="true" tabindex="-1"></a> <span class="co"># scale_x_discrete(labels = labels) +</span></span>
|
||||
<span id="cb4-28"><a href="#cb4-28" aria-hidden="true" tabindex="-1"></a> <span class="fu">coord_flip</span>() <span class="sc">+</span></span>
|
||||
<span id="cb4-29"><a href="#cb4-29" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span>
|
||||
<span id="cb4-30"><a href="#cb4-30" aria-hidden="true" tabindex="-1"></a> <span class="at">x =</span> <span class="st">"Month of Birth"</span></span>
|
||||
<span id="cb4-31"><a href="#cb4-31" aria-hidden="true" tabindex="-1"></a> , <span class="at">y =</span> <span class="st">"Percentage of Births"</span></span>
|
||||
<span id="cb4-32"><a href="#cb4-32" aria-hidden="true" tabindex="-1"></a> , <span class="at">title =</span> <span class="st">"Are United States Born NHL Players More Likely to be Born Early in the Year?"</span></span>
|
||||
<span id="cb4-33"><a href="#cb4-33" aria-hidden="true" tabindex="-1"></a> , <span class="at">subtitle =</span> <span class="st">"Comparing the distribution of birth months between US NHL players and US in general"</span></span>
|
||||
<span id="cb4-34"><a href="#cb4-34" aria-hidden="true" tabindex="-1"></a> , <span class="at">caption =</span> glue<span class="sc">::</span><span class="fu">glue</span>(</span>
|
||||
<span id="cb4-35"><a href="#cb4-35" aria-hidden="true" tabindex="-1"></a> <span class="st">"<img src = {nhl_icon} width = '15' height=' 15' /> - US NHL Players Birth Month Distribution <br /></span></span>
|
||||
<span id="cb4-36"><a href="#cb4-36" aria-hidden="true" tabindex="-1"></a><span class="st"> <img src = {usa_icon} width = '15' height=' 15' /> - US Birth Month (2007-2022) Distribution"</span></span>
|
||||
<span id="cb4-37"><a href="#cb4-37" aria-hidden="true" tabindex="-1"></a> )</span>
|
||||
<span id="cb4-38"><a href="#cb4-38" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span>
|
||||
<span id="cb4-39"><a href="#cb4-39" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme_minimal</span>() <span class="sc">+</span></span>
|
||||
<span id="cb4-40"><a href="#cb4-40" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme</span>(</span>
|
||||
<span id="cb4-41"><a href="#cb4-41" aria-hidden="true" tabindex="-1"></a> <span class="at">plot.caption =</span> <span class="fu">element_markdown</span>()</span>
|
||||
<span id="cb4-42"><a href="#cb4-42" aria-hidden="true" tabindex="-1"></a> , <span class="at">plot.title.position =</span> <span class="st">"plot"</span></span>
|
||||
<span id="cb4-43"><a href="#cb4-43" aria-hidden="true" tabindex="-1"></a> , <span class="at">text =</span> <span class="fu">element_text</span>(<span class="at">size =</span> <span class="dv">16</span>)</span>
|
||||
<span id="cb4-44"><a href="#cb4-44" aria-hidden="true" tabindex="-1"></a> , <span class="at">axis.text =</span> <span class="fu">element_markdown</span>()</span>
|
||||
<span id="cb4-45"><a href="#cb4-45" aria-hidden="true" tabindex="-1"></a> )</span>
|
||||
<span id="cb4-46"><a href="#cb4-46" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb4-47"><a href="#cb4-47" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb4-48"><a href="#cb4-48" aria-hidden="true" tabindex="-1"></a>g1</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="index_files/figure-html/Graph_It-1.png" class="img-fluid figure-img" width="960"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Stats ----</span></span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a>broom<span class="sc">::</span><span class="fu">tidy</span>(<span class="fu">chisq.test</span>(<span class="at">x =</span> combined<span class="sc">$</span>players, <span class="at">p =</span> combined<span class="sc">$</span>country_pct))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output cell-output-stdout">
|
||||
<pre><code># A tibble: 1 × 4
|
||||
statistic p.value parameter method
|
||||
<dbl> <dbl> <dbl> <chr>
|
||||
1 14.8 0.190 11 Chi-squared test for given probabilities</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<p>If we look at this from a more stats based perspective, running a chi square test on the amount of players in the NHL per month, based on the US expected birth rate, we do see however there is quite a high p value. This is lets us know we can not reject the Null hypothesis that these are the same thing.</p>
|
||||
</section>
|
||||
<section id="a-little-fun" class="level1">
|
||||
<h1>A Little Fun</h1>
|
||||
<p>For just a little bit of fun I pulled birth data for the entire world using the UN’s website. I then filtered this out to just countries that currently have players in the NHL. The graph shows more of the same, looks to lean heavily to the beginning of the year, and this time the stat back it up. So being born early in the year may in fact help your chances of making it to the NHL</p>
|
||||
<div class="cell">
|
||||
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>g2 <span class="ot"><-</span> combined_world <span class="sc">%>%</span></span>
|
||||
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x =</span> forcats<span class="sc">::</span><span class="fu">fct_reorder</span>(mob, <span class="sc">-</span>mob_id))) <span class="sc">+</span></span>
|
||||
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_line</span>(<span class="fu">aes</span>(<span class="at">y =</span> random, <span class="at">group =</span> <span class="dv">1</span>), <span class="at">linetype =</span> <span class="dv">2</span>, <span class="at">color =</span> <span class="st">"grey60"</span>) <span class="sc">+</span></span>
|
||||
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_linerange</span>(<span class="fu">aes</span>(<span class="at">ymin =</span> world_pct, <span class="at">ymax =</span> player_pct)) <span class="sc">+</span></span>
|
||||
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_image</span>(<span class="fu">aes</span>(<span class="at">image =</span> world_icon, <span class="at">y =</span> world_pct), <span class="at">size =</span> <span class="fl">0.08</span>) <span class="sc">+</span></span>
|
||||
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_image</span>(<span class="fu">aes</span>(<span class="at">image =</span> nhl_icon, <span class="at">y =</span> player_pct), <span class="at">size =</span> <span class="fl">0.1</span>) <span class="sc">+</span></span>
|
||||
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_text</span>(<span class="fu">aes</span>(<span class="at">label =</span> scales<span class="sc">::</span><span class="fu">percent</span>(player_pct, <span class="at">accuracy =</span> .<span class="dv">1</span>),</span>
|
||||
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> dplyr<span class="sc">::</span><span class="fu">if_else</span>(player_pct <span class="sc">></span> world_pct, player_pct <span class="sc">+</span> .<span class="dv">006</span>, player_pct <span class="sc">-</span> .<span class="dv">006</span>)), <span class="at">size =</span> <span class="dv">5</span>) <span class="sc">+</span></span>
|
||||
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_text</span>(<span class="fu">aes</span>(<span class="at">label =</span> scales<span class="sc">::</span><span class="fu">percent</span>(world_pct, <span class="at">accuracy =</span> .<span class="dv">1</span>),</span>
|
||||
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> dplyr<span class="sc">::</span><span class="fu">if_else</span>(world_pct <span class="sc">></span> player_pct, world_pct <span class="sc">+</span> .<span class="dv">006</span>, world_pct <span class="sc">-</span> .<span class="dv">006</span>)), <span class="at">size =</span> <span class="dv">5</span>) <span class="sc">+</span></span>
|
||||
<span id="cb7-11"><a href="#cb7-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_y_continuous</span>(<span class="at">labels =</span> scales<span class="sc">::</span>percent) <span class="sc">+</span></span>
|
||||
<span id="cb7-12"><a href="#cb7-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">coord_flip</span>() <span class="sc">+</span></span>
|
||||
<span id="cb7-13"><a href="#cb7-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span>
|
||||
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true" tabindex="-1"></a> <span class="at">x =</span> <span class="st">"Month of Birth"</span></span>
|
||||
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a> , <span class="at">y =</span> <span class="st">"Percentage of Births"</span></span>
|
||||
<span id="cb7-16"><a href="#cb7-16" aria-hidden="true" tabindex="-1"></a> , <span class="at">title =</span> <span class="st">"What Birthday is most liekly to make the NHL?"</span></span>
|
||||
<span id="cb7-17"><a href="#cb7-17" aria-hidden="true" tabindex="-1"></a> , <span class="at">subtitle =</span> <span class="st">"Comparing the distribution of birth months between All NHL players and the World in general"</span></span>
|
||||
<span id="cb7-18"><a href="#cb7-18" aria-hidden="true" tabindex="-1"></a> , <span class="at">caption =</span> glue<span class="sc">::</span><span class="fu">glue</span>(</span>
|
||||
<span id="cb7-19"><a href="#cb7-19" aria-hidden="true" tabindex="-1"></a> <span class="st">"<img src = {nhl_icon} width = '15' height=' 15' /> - US NHL Players Birth Month Distribution <br /></span></span>
|
||||
<span id="cb7-20"><a href="#cb7-20" aria-hidden="true" tabindex="-1"></a><span class="st"> <img src = {world_icon} width = '15' height=' 15' /> - World Birth Month (2007-2022) Distribution"</span></span>
|
||||
<span id="cb7-21"><a href="#cb7-21" aria-hidden="true" tabindex="-1"></a> )</span>
|
||||
<span id="cb7-22"><a href="#cb7-22" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span>
|
||||
<span id="cb7-23"><a href="#cb7-23" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme_minimal</span>() <span class="sc">+</span></span>
|
||||
<span id="cb7-24"><a href="#cb7-24" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme</span>(</span>
|
||||
<span id="cb7-25"><a href="#cb7-25" aria-hidden="true" tabindex="-1"></a> <span class="at">plot.caption =</span> <span class="fu">element_markdown</span>()</span>
|
||||
<span id="cb7-26"><a href="#cb7-26" aria-hidden="true" tabindex="-1"></a> , <span class="at">plot.title.position =</span> <span class="st">"plot"</span></span>
|
||||
<span id="cb7-27"><a href="#cb7-27" aria-hidden="true" tabindex="-1"></a> , <span class="at">text =</span> <span class="fu">element_text</span>(<span class="at">size =</span> <span class="dv">16</span>)</span>
|
||||
<span id="cb7-28"><a href="#cb7-28" aria-hidden="true" tabindex="-1"></a> , <span class="at">axis.text =</span> <span class="fu">element_markdown</span>()</span>
|
||||
<span id="cb7-29"><a href="#cb7-29" aria-hidden="true" tabindex="-1"></a> )</span>
|
||||
<span id="cb7-30"><a href="#cb7-30" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb7-31"><a href="#cb7-31" aria-hidden="true" tabindex="-1"></a>g2</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<div>
|
||||
<figure class="figure">
|
||||
<p><img src="index_files/figure-html/world_graph-1.png" class="img-fluid figure-img" width="960"></p>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a>broom<span class="sc">::</span><span class="fu">tidy</span>(<span class="fu">chisq.test</span>(<span class="at">x =</span> combined_world<span class="sc">$</span>players, <span class="at">p =</span> combined_world<span class="sc">$</span>world_pct))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output cell-output-stdout">
|
||||
<pre><code># A tibble: 1 × 4
|
||||
statistic p.value parameter method
|
||||
<dbl> <dbl> <dbl> <chr>
|
||||
1 43.1 0.0000104 11 Chi-squared test for given probabilities</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2024,
|
||||
author = {Belanger, Kyle},
|
||||
title = {Does a {US} {Born} {Players} {Birthdate} Affect Their Shot at
|
||||
the {NHL}},
|
||||
date = {2024-06-08},
|
||||
langid = {en}
|
||||
}
|
||||
</code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-belanger2024" class="csl-entry quarto-appendix-citeas" role="listitem">
|
||||
Belanger, Kyle. 2024. <span>“Does a US Born Players Birthdate Affect
|
||||
Their Shot at the NHL.”</span> June 8, 2024.
|
||||
</div></div></section></div></main> <!-- /main -->
|
||||
<script id="quarto-html-after-body" type="application/javascript">
|
||||
window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
const toggleBodyColorMode = (bsSheetEl) => {
|
||||
const mode = bsSheetEl.getAttribute("data-mode");
|
||||
const bodyEl = window.document.querySelector("body");
|
||||
if (mode === "dark") {
|
||||
bodyEl.classList.add("quarto-dark");
|
||||
bodyEl.classList.remove("quarto-light");
|
||||
} else {
|
||||
bodyEl.classList.add("quarto-light");
|
||||
bodyEl.classList.remove("quarto-dark");
|
||||
}
|
||||
}
|
||||
const toggleBodyColorPrimary = () => {
|
||||
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
|
||||
if (bsSheetEl) {
|
||||
toggleBodyColorMode(bsSheetEl);
|
||||
}
|
||||
}
|
||||
toggleBodyColorPrimary();
|
||||
const icon = "";
|
||||
const anchorJS = new window.AnchorJS();
|
||||
anchorJS.options = {
|
||||
placement: 'right',
|
||||
icon: icon
|
||||
};
|
||||
anchorJS.add('.anchored');
|
||||
const isCodeAnnotation = (el) => {
|
||||
for (const clz of el.classList) {
|
||||
if (clz.startsWith('code-annotation-')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const clipboard = new window.ClipboardJS('.code-copy-button', {
|
||||
text: function(trigger) {
|
||||
const codeEl = trigger.previousElementSibling.cloneNode(true);
|
||||
for (const childEl of codeEl.children) {
|
||||
if (isCodeAnnotation(childEl)) {
|
||||
childEl.remove();
|
||||
}
|
||||
}
|
||||
return codeEl.innerText;
|
||||
}
|
||||
});
|
||||
clipboard.on('success', function(e) {
|
||||
// button target
|
||||
const button = e.trigger;
|
||||
// don't keep focus
|
||||
button.blur();
|
||||
// flash "checked"
|
||||
button.classList.add('code-copy-button-checked');
|
||||
var currentTitle = button.getAttribute("title");
|
||||
button.setAttribute("title", "Copied!");
|
||||
let tooltip;
|
||||
if (window.bootstrap) {
|
||||
button.setAttribute("data-bs-toggle", "tooltip");
|
||||
button.setAttribute("data-bs-placement", "left");
|
||||
button.setAttribute("data-bs-title", "Copied!");
|
||||
tooltip = new bootstrap.Tooltip(button,
|
||||
{ trigger: "manual",
|
||||
customClass: "code-copy-button-tooltip",
|
||||
offset: [0, -8]});
|
||||
tooltip.show();
|
||||
}
|
||||
setTimeout(function() {
|
||||
if (tooltip) {
|
||||
tooltip.hide();
|
||||
button.removeAttribute("data-bs-title");
|
||||
button.removeAttribute("data-bs-toggle");
|
||||
button.removeAttribute("data-bs-placement");
|
||||
}
|
||||
button.setAttribute("title", currentTitle);
|
||||
button.classList.remove('code-copy-button-checked');
|
||||
}, 1000);
|
||||
// clear code selection
|
||||
e.clearSelection();
|
||||
});
|
||||
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||||
var mailtoRegex = new RegExp(/^mailto:/);
|
||||
var filterRegex = new RegExp('/' + window.location.host + '/');
|
||||
var isInternal = (href) => {
|
||||
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
|
||||
}
|
||||
// Inspect non-navigation links and adorn them if external
|
||||
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool)');
|
||||
for (var i=0; i<links.length; i++) {
|
||||
const link = links[i];
|
||||
if (!isInternal(link.href)) {
|
||||
// undo the damage that might have been done by quarto-nav.js in the case of
|
||||
// links that we want to consider external
|
||||
if (link.dataset.originalHref !== undefined) {
|
||||
link.href = link.dataset.originalHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
|
||||
const config = {
|
||||
allowHTML: true,
|
||||
maxWidth: 500,
|
||||
delay: 100,
|
||||
arrow: false,
|
||||
appendTo: function(el) {
|
||||
return el.parentElement;
|
||||
},
|
||||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
theme: 'quarto',
|
||||
placement: 'bottom-start',
|
||||
};
|
||||
if (contentFn) {
|
||||
config.content = contentFn;
|
||||
}
|
||||
if (onTriggerFn) {
|
||||
config.onTrigger = onTriggerFn;
|
||||
}
|
||||
if (onUntriggerFn) {
|
||||
config.onUntrigger = onUntriggerFn;
|
||||
}
|
||||
window.tippy(el, config);
|
||||
}
|
||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||||
for (var i=0; i<noterefs.length; i++) {
|
||||
const ref = noterefs[i];
|
||||
tippyHover(ref, function() {
|
||||
// use id or data attribute instead here
|
||||
let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
|
||||
try { href = new URL(href).hash; } catch {}
|
||||
const id = href.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note) {
|
||||
return note.innerHTML;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
const xrefs = window.document.querySelectorAll('a.quarto-xref');
|
||||
const processXRef = (id, note) => {
|
||||
// Strip column container classes
|
||||
const stripColumnClz = (el) => {
|
||||
el.classList.remove("page-full", "page-columns");
|
||||
if (el.children) {
|
||||
for (const child of el.children) {
|
||||
stripColumnClz(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
stripColumnClz(note)
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
return container.innerHTML
|
||||
} else {
|
||||
if (window.Quarto?.typesetMath) {
|
||||
window.Quarto.typesetMath(note);
|
||||
}
|
||||
return note.innerHTML;
|
||||
}
|
||||
} else {
|
||||
// Remove any anchor links if they are present
|
||||
const anchorLink = note.querySelector('a.anchorjs-link');
|
||||
if (anchorLink) {
|
||||
anchorLink.remove();
|
||||
}
|
||||
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++) {
|
||||
const xref = xrefs[i];
|
||||
tippyHover(xref, undefined, function(instance) {
|
||||
instance.disable();
|
||||
let url = xref.getAttribute('href');
|
||||
let hash = undefined;
|
||||
if (url.startsWith('#')) {
|
||||
hash = url;
|
||||
} else {
|
||||
try { hash = new URL(url).hash; } catch {}
|
||||
}
|
||||
if (hash) {
|
||||
const id = hash.replace(/^#\/?/, "");
|
||||
const note = window.document.getElementById(id);
|
||||
if (note !== null) {
|
||||
try {
|
||||
const html = processXRef(id, note.cloneNode(true));
|
||||
instance.setContent(html);
|
||||
} finally {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch this
|
||||
fetch(url.split('#')[0])
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.getElementById(id);
|
||||
if (note !== null) {
|
||||
const html = processXRef(id, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// See if we can fetch a full url (with no hash to target)
|
||||
// This is a special case and we should probably do some content thinning / targeting
|
||||
fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
const parser = new DOMParser();
|
||||
const htmlDoc = parser.parseFromString(html, "text/html");
|
||||
const note = htmlDoc.querySelector('main.content');
|
||||
if (note !== null) {
|
||||
// This should only happen for chapter cross references
|
||||
// (since there is no id in the URL)
|
||||
// remove the first header
|
||||
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
|
||||
note.children[0].remove();
|
||||
}
|
||||
const html = processXRef(null, note);
|
||||
instance.setContent(html);
|
||||
}
|
||||
}).finally(() => {
|
||||
instance.enable();
|
||||
instance.show();
|
||||
});
|
||||
}
|
||||
}, function(instance) {
|
||||
});
|
||||
}
|
||||
let selectedAnnoteEl;
|
||||
const selectorForAnnotation = ( cell, annotation) => {
|
||||
let cellAttr = 'data-code-cell="' + cell + '"';
|
||||
let lineAttr = 'data-code-annotation="' + annotation + '"';
|
||||
const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
|
||||
return selector;
|
||||
}
|
||||
const selectCodeLines = (annoteEl) => {
|
||||
const doc = window.document;
|
||||
const targetCell = annoteEl.getAttribute("data-target-cell");
|
||||
const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
|
||||
const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
|
||||
const lines = annoteSpan.getAttribute("data-code-lines").split(",");
|
||||
const lineIds = lines.map((line) => {
|
||||
return targetCell + "-" + line;
|
||||
})
|
||||
let top = null;
|
||||
let height = null;
|
||||
let parent = null;
|
||||
if (lineIds.length > 0) {
|
||||
//compute the position of the single el (top and bottom and make a div)
|
||||
const el = window.document.getElementById(lineIds[0]);
|
||||
top = el.offsetTop;
|
||||
height = el.offsetHeight;
|
||||
parent = el.parentElement.parentElement;
|
||||
if (lineIds.length > 1) {
|
||||
const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
|
||||
const bottom = lastEl.offsetTop + lastEl.offsetHeight;
|
||||
height = bottom - top;
|
||||
}
|
||||
if (top !== null && height !== null && parent !== null) {
|
||||
// cook up a div (if necessary) and position it
|
||||
let div = window.document.getElementById("code-annotation-line-highlight");
|
||||
if (div === null) {
|
||||
div = window.document.createElement("div");
|
||||
div.setAttribute("id", "code-annotation-line-highlight");
|
||||
div.style.position = 'absolute';
|
||||
parent.appendChild(div);
|
||||
}
|
||||
div.style.top = top - 2 + "px";
|
||||
div.style.height = height + 4 + "px";
|
||||
div.style.left = 0;
|
||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||||
if (gutterDiv === null) {
|
||||
gutterDiv = window.document.createElement("div");
|
||||
gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
|
||||
gutterDiv.style.position = 'absolute';
|
||||
const codeCell = window.document.getElementById(targetCell);
|
||||
const gutter = codeCell.querySelector('.code-annotation-gutter');
|
||||
gutter.appendChild(gutterDiv);
|
||||
}
|
||||
gutterDiv.style.top = top - 2 + "px";
|
||||
gutterDiv.style.height = height + 4 + "px";
|
||||
}
|
||||
selectedAnnoteEl = annoteEl;
|
||||
}
|
||||
};
|
||||
const unselectCodeLines = () => {
|
||||
const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
|
||||
elementsIds.forEach((elId) => {
|
||||
const div = window.document.getElementById(elId);
|
||||
if (div) {
|
||||
div.remove();
|
||||
}
|
||||
});
|
||||
selectedAnnoteEl = undefined;
|
||||
};
|
||||
// Handle positioning of the toggle
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
throttle(() => {
|
||||
elRect = undefined;
|
||||
if (selectedAnnoteEl) {
|
||||
selectCodeLines(selectedAnnoteEl);
|
||||
}
|
||||
}, 10)
|
||||
);
|
||||
function throttle(fn, ms) {
|
||||
let throttle = false;
|
||||
let timer;
|
||||
return (...args) => {
|
||||
if(!throttle) { // first call gets through
|
||||
fn.apply(this, args);
|
||||
throttle = true;
|
||||
} else { // all the others get throttled
|
||||
if(timer) clearTimeout(timer); // cancel #2
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
timer = throttle = false;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Attach click handler to the DT
|
||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||||
for (const annoteDlNode of annoteDls) {
|
||||
annoteDlNode.addEventListener('click', (event) => {
|
||||
const clickedEl = event.target;
|
||||
if (clickedEl !== selectedAnnoteEl) {
|
||||
unselectCodeLines();
|
||||
const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
|
||||
if (activeEl) {
|
||||
activeEl.classList.remove('code-annotation-active');
|
||||
}
|
||||
selectCodeLines(clickedEl);
|
||||
clickedEl.classList.add('code-annotation-active');
|
||||
} else {
|
||||
// Unselect the line
|
||||
unselectCodeLines();
|
||||
clickedEl.classList.remove('code-annotation-active');
|
||||
}
|
||||
});
|
||||
}
|
||||
const findCites = (el) => {
|
||||
const parentEl = el.parentElement;
|
||||
if (parentEl) {
|
||||
const cites = parentEl.dataset.cites;
|
||||
if (cites) {
|
||||
return {
|
||||
el,
|
||||
cites: cites.split(' ')
|
||||
};
|
||||
} else {
|
||||
return findCites(el.parentElement)
|
||||
}
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
|
||||
for (var i=0; i<bibliorefs.length; i++) {
|
||||
const ref = bibliorefs[i];
|
||||
const citeInfo = findCites(ref);
|
||||
if (citeInfo) {
|
||||
tippyHover(citeInfo.el, function() {
|
||||
var popup = window.document.createElement('div');
|
||||
citeInfo.cites.forEach(function(cite) {
|
||||
var citeDiv = window.document.createElement('div');
|
||||
citeDiv.classList.add('hanging-indent');
|
||||
citeDiv.classList.add('csl-entry');
|
||||
var biblioDiv = window.document.getElementById('ref-' + cite);
|
||||
if (biblioDiv) {
|
||||
citeDiv.innerHTML = biblioDiv.innerHTML;
|
||||
}
|
||||
popup.appendChild(citeDiv);
|
||||
});
|
||||
return popup.innerHTML;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</div> <!-- /content -->
|
||||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
After Width: | Height: | Size: 266 KiB |
After Width: | Height: | Size: 301 KiB |
148
_site/site_libs/bootstrap/bootstrap-icons.css
vendored
|
@ -1,8 +1,14 @@
|
|||
/*!
|
||||
* Bootstrap Icons v1.11.1 (https://icons.getbootstrap.com/)
|
||||
* Copyright 2019-2023 The Bootstrap Authors
|
||||
* Licensed under MIT (https://github.com/twbs/icons/blob/main/LICENSE)
|
||||
*/
|
||||
|
||||
@font-face {
|
||||
font-display: block;
|
||||
font-family: "bootstrap-icons";
|
||||
src:
|
||||
url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
||||
url("./bootstrap-icons.woff?2820a3852bdb9a5832199cc61cec4e65") format("woff");
|
||||
}
|
||||
|
||||
.bi::before,
|
||||
|
@ -441,7 +447,6 @@ url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
|||
.bi-cloud-fog2::before { content: "\f2a2"; }
|
||||
.bi-cloud-hail-fill::before { content: "\f2a3"; }
|
||||
.bi-cloud-hail::before { content: "\f2a4"; }
|
||||
.bi-cloud-haze-1::before { content: "\f2a5"; }
|
||||
.bi-cloud-haze-fill::before { content: "\f2a6"; }
|
||||
.bi-cloud-haze::before { content: "\f2a7"; }
|
||||
.bi-cloud-haze2-fill::before { content: "\f2a8"; }
|
||||
|
@ -1437,21 +1442,16 @@ url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
|||
.bi-dpad::before { content: "\f687"; }
|
||||
.bi-ear-fill::before { content: "\f688"; }
|
||||
.bi-ear::before { content: "\f689"; }
|
||||
.bi-envelope-check-1::before { content: "\f68a"; }
|
||||
.bi-envelope-check-fill::before { content: "\f68b"; }
|
||||
.bi-envelope-check::before { content: "\f68c"; }
|
||||
.bi-envelope-dash-1::before { content: "\f68d"; }
|
||||
.bi-envelope-dash-fill::before { content: "\f68e"; }
|
||||
.bi-envelope-dash::before { content: "\f68f"; }
|
||||
.bi-envelope-exclamation-1::before { content: "\f690"; }
|
||||
.bi-envelope-exclamation-fill::before { content: "\f691"; }
|
||||
.bi-envelope-exclamation::before { content: "\f692"; }
|
||||
.bi-envelope-plus-fill::before { content: "\f693"; }
|
||||
.bi-envelope-plus::before { content: "\f694"; }
|
||||
.bi-envelope-slash-1::before { content: "\f695"; }
|
||||
.bi-envelope-slash-fill::before { content: "\f696"; }
|
||||
.bi-envelope-slash::before { content: "\f697"; }
|
||||
.bi-envelope-x-1::before { content: "\f698"; }
|
||||
.bi-envelope-x-fill::before { content: "\f699"; }
|
||||
.bi-envelope-x::before { content: "\f69a"; }
|
||||
.bi-explicit-fill::before { content: "\f69b"; }
|
||||
|
@ -1461,8 +1461,6 @@ url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
|||
.bi-list-columns-reverse::before { content: "\f69f"; }
|
||||
.bi-list-columns::before { content: "\f6a0"; }
|
||||
.bi-meta::before { content: "\f6a1"; }
|
||||
.bi-mortorboard-fill::before { content: "\f6a2"; }
|
||||
.bi-mortorboard::before { content: "\f6a3"; }
|
||||
.bi-nintendo-switch::before { content: "\f6a4"; }
|
||||
.bi-pc-display-horizontal::before { content: "\f6a5"; }
|
||||
.bi-pc-display::before { content: "\f6a6"; }
|
||||
|
@ -1481,7 +1479,6 @@ url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
|||
.bi-send-check::before { content: "\f6b3"; }
|
||||
.bi-send-dash-fill::before { content: "\f6b4"; }
|
||||
.bi-send-dash::before { content: "\f6b5"; }
|
||||
.bi-send-exclamation-1::before { content: "\f6b6"; }
|
||||
.bi-send-exclamation-fill::before { content: "\f6b7"; }
|
||||
.bi-send-exclamation::before { content: "\f6b8"; }
|
||||
.bi-send-fill::before { content: "\f6b9"; }
|
||||
|
@ -1493,7 +1490,6 @@ url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
|||
.bi-send-x::before { content: "\f6bf"; }
|
||||
.bi-send::before { content: "\f6c0"; }
|
||||
.bi-steam::before { content: "\f6c1"; }
|
||||
.bi-terminal-dash-1::before { content: "\f6c2"; }
|
||||
.bi-terminal-dash::before { content: "\f6c3"; }
|
||||
.bi-terminal-plus::before { content: "\f6c4"; }
|
||||
.bi-terminal-split::before { content: "\f6c5"; }
|
||||
|
@ -1523,7 +1519,6 @@ url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
|||
.bi-usb-symbol::before { content: "\f6dd"; }
|
||||
.bi-usb::before { content: "\f6de"; }
|
||||
.bi-boombox-fill::before { content: "\f6df"; }
|
||||
.bi-displayport-1::before { content: "\f6e0"; }
|
||||
.bi-displayport::before { content: "\f6e1"; }
|
||||
.bi-gpu-card::before { content: "\f6e2"; }
|
||||
.bi-memory::before { content: "\f6e3"; }
|
||||
|
@ -1536,8 +1531,6 @@ url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
|||
.bi-pci-card::before { content: "\f6ea"; }
|
||||
.bi-router-fill::before { content: "\f6eb"; }
|
||||
.bi-router::before { content: "\f6ec"; }
|
||||
.bi-ssd-fill::before { content: "\f6ed"; }
|
||||
.bi-ssd::before { content: "\f6ee"; }
|
||||
.bi-thunderbolt-fill::before { content: "\f6ef"; }
|
||||
.bi-thunderbolt::before { content: "\f6f0"; }
|
||||
.bi-usb-drive-fill::before { content: "\f6f1"; }
|
||||
|
@ -1644,7 +1637,6 @@ url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
|||
.bi-filetype-pdf::before { content: "\f756"; }
|
||||
.bi-filetype-php::before { content: "\f757"; }
|
||||
.bi-filetype-png::before { content: "\f758"; }
|
||||
.bi-filetype-ppt-1::before { content: "\f759"; }
|
||||
.bi-filetype-ppt::before { content: "\f75a"; }
|
||||
.bi-filetype-psd::before { content: "\f75b"; }
|
||||
.bi-filetype-py::before { content: "\f75c"; }
|
||||
|
@ -1660,7 +1652,6 @@ url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
|||
.bi-filetype-txt::before { content: "\f766"; }
|
||||
.bi-filetype-wav::before { content: "\f767"; }
|
||||
.bi-filetype-woff::before { content: "\f768"; }
|
||||
.bi-filetype-xls-1::before { content: "\f769"; }
|
||||
.bi-filetype-xls::before { content: "\f76a"; }
|
||||
.bi-filetype-xml::before { content: "\f76b"; }
|
||||
.bi-filetype-yml::before { content: "\f76c"; }
|
||||
|
@ -1703,56 +1694,38 @@ url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
|||
.bi-filetype-json::before { content: "\f791"; }
|
||||
.bi-filetype-pptx::before { content: "\f792"; }
|
||||
.bi-filetype-xlsx::before { content: "\f793"; }
|
||||
.bi-1-circle-1::before { content: "\f794"; }
|
||||
.bi-1-circle-fill-1::before { content: "\f795"; }
|
||||
.bi-1-circle-fill::before { content: "\f796"; }
|
||||
.bi-1-circle::before { content: "\f797"; }
|
||||
.bi-1-square-fill::before { content: "\f798"; }
|
||||
.bi-1-square::before { content: "\f799"; }
|
||||
.bi-2-circle-1::before { content: "\f79a"; }
|
||||
.bi-2-circle-fill-1::before { content: "\f79b"; }
|
||||
.bi-2-circle-fill::before { content: "\f79c"; }
|
||||
.bi-2-circle::before { content: "\f79d"; }
|
||||
.bi-2-square-fill::before { content: "\f79e"; }
|
||||
.bi-2-square::before { content: "\f79f"; }
|
||||
.bi-3-circle-1::before { content: "\f7a0"; }
|
||||
.bi-3-circle-fill-1::before { content: "\f7a1"; }
|
||||
.bi-3-circle-fill::before { content: "\f7a2"; }
|
||||
.bi-3-circle::before { content: "\f7a3"; }
|
||||
.bi-3-square-fill::before { content: "\f7a4"; }
|
||||
.bi-3-square::before { content: "\f7a5"; }
|
||||
.bi-4-circle-1::before { content: "\f7a6"; }
|
||||
.bi-4-circle-fill-1::before { content: "\f7a7"; }
|
||||
.bi-4-circle-fill::before { content: "\f7a8"; }
|
||||
.bi-4-circle::before { content: "\f7a9"; }
|
||||
.bi-4-square-fill::before { content: "\f7aa"; }
|
||||
.bi-4-square::before { content: "\f7ab"; }
|
||||
.bi-5-circle-1::before { content: "\f7ac"; }
|
||||
.bi-5-circle-fill-1::before { content: "\f7ad"; }
|
||||
.bi-5-circle-fill::before { content: "\f7ae"; }
|
||||
.bi-5-circle::before { content: "\f7af"; }
|
||||
.bi-5-square-fill::before { content: "\f7b0"; }
|
||||
.bi-5-square::before { content: "\f7b1"; }
|
||||
.bi-6-circle-1::before { content: "\f7b2"; }
|
||||
.bi-6-circle-fill-1::before { content: "\f7b3"; }
|
||||
.bi-6-circle-fill::before { content: "\f7b4"; }
|
||||
.bi-6-circle::before { content: "\f7b5"; }
|
||||
.bi-6-square-fill::before { content: "\f7b6"; }
|
||||
.bi-6-square::before { content: "\f7b7"; }
|
||||
.bi-7-circle-1::before { content: "\f7b8"; }
|
||||
.bi-7-circle-fill-1::before { content: "\f7b9"; }
|
||||
.bi-7-circle-fill::before { content: "\f7ba"; }
|
||||
.bi-7-circle::before { content: "\f7bb"; }
|
||||
.bi-7-square-fill::before { content: "\f7bc"; }
|
||||
.bi-7-square::before { content: "\f7bd"; }
|
||||
.bi-8-circle-1::before { content: "\f7be"; }
|
||||
.bi-8-circle-fill-1::before { content: "\f7bf"; }
|
||||
.bi-8-circle-fill::before { content: "\f7c0"; }
|
||||
.bi-8-circle::before { content: "\f7c1"; }
|
||||
.bi-8-square-fill::before { content: "\f7c2"; }
|
||||
.bi-8-square::before { content: "\f7c3"; }
|
||||
.bi-9-circle-1::before { content: "\f7c4"; }
|
||||
.bi-9-circle-fill-1::before { content: "\f7c5"; }
|
||||
.bi-9-circle-fill::before { content: "\f7c6"; }
|
||||
.bi-9-circle::before { content: "\f7c7"; }
|
||||
.bi-9-square-fill::before { content: "\f7c8"; }
|
||||
|
@ -1771,8 +1744,6 @@ url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
|||
.bi-browser-edge::before { content: "\f7d5"; }
|
||||
.bi-browser-firefox::before { content: "\f7d6"; }
|
||||
.bi-browser-safari::before { content: "\f7d7"; }
|
||||
.bi-c-circle-1::before { content: "\f7d8"; }
|
||||
.bi-c-circle-fill-1::before { content: "\f7d9"; }
|
||||
.bi-c-circle-fill::before { content: "\f7da"; }
|
||||
.bi-c-circle::before { content: "\f7db"; }
|
||||
.bi-c-square-fill::before { content: "\f7dc"; }
|
||||
|
@ -1783,8 +1754,6 @@ url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
|||
.bi-car-front::before { content: "\f7e1"; }
|
||||
.bi-cassette-fill::before { content: "\f7e2"; }
|
||||
.bi-cassette::before { content: "\f7e3"; }
|
||||
.bi-cc-circle-1::before { content: "\f7e4"; }
|
||||
.bi-cc-circle-fill-1::before { content: "\f7e5"; }
|
||||
.bi-cc-circle-fill::before { content: "\f7e6"; }
|
||||
.bi-cc-circle::before { content: "\f7e7"; }
|
||||
.bi-cc-square-fill::before { content: "\f7e8"; }
|
||||
|
@ -1803,8 +1772,6 @@ url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
|||
.bi-filetype-sql::before { content: "\f7f5"; }
|
||||
.bi-fire::before { content: "\f7f6"; }
|
||||
.bi-google-play::before { content: "\f7f7"; }
|
||||
.bi-h-circle-1::before { content: "\f7f8"; }
|
||||
.bi-h-circle-fill-1::before { content: "\f7f9"; }
|
||||
.bi-h-circle-fill::before { content: "\f7fa"; }
|
||||
.bi-h-circle::before { content: "\f7fb"; }
|
||||
.bi-h-square-fill::before { content: "\f7fc"; }
|
||||
|
@ -1813,8 +1780,6 @@ url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
|||
.bi-lungs-fill::before { content: "\f7ff"; }
|
||||
.bi-lungs::before { content: "\f800"; }
|
||||
.bi-microsoft-teams::before { content: "\f801"; }
|
||||
.bi-p-circle-1::before { content: "\f802"; }
|
||||
.bi-p-circle-fill-1::before { content: "\f803"; }
|
||||
.bi-p-circle-fill::before { content: "\f804"; }
|
||||
.bi-p-circle::before { content: "\f805"; }
|
||||
.bi-p-square-fill::before { content: "\f806"; }
|
||||
|
@ -1823,8 +1788,6 @@ url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
|||
.bi-pass::before { content: "\f809"; }
|
||||
.bi-prescription::before { content: "\f80a"; }
|
||||
.bi-prescription2::before { content: "\f80b"; }
|
||||
.bi-r-circle-1::before { content: "\f80c"; }
|
||||
.bi-r-circle-fill-1::before { content: "\f80d"; }
|
||||
.bi-r-circle-fill::before { content: "\f80e"; }
|
||||
.bi-r-circle::before { content: "\f80f"; }
|
||||
.bi-r-square-fill::before { content: "\f810"; }
|
||||
|
@ -2016,3 +1979,100 @@ url("./bootstrap-icons.woff?2ab2cbbe07fcebb53bdaa7313bb290f2") format("woff");
|
|||
.bi-sina-weibo::before { content: "\f8ca"; }
|
||||
.bi-tencent-qq::before { content: "\f8cb"; }
|
||||
.bi-wikipedia::before { content: "\f8cc"; }
|
||||
.bi-alphabet-uppercase::before { content: "\f2a5"; }
|
||||
.bi-alphabet::before { content: "\f68a"; }
|
||||
.bi-amazon::before { content: "\f68d"; }
|
||||
.bi-arrows-collapse-vertical::before { content: "\f690"; }
|
||||
.bi-arrows-expand-vertical::before { content: "\f695"; }
|
||||
.bi-arrows-vertical::before { content: "\f698"; }
|
||||
.bi-arrows::before { content: "\f6a2"; }
|
||||
.bi-ban-fill::before { content: "\f6a3"; }
|
||||
.bi-ban::before { content: "\f6b6"; }
|
||||
.bi-bing::before { content: "\f6c2"; }
|
||||
.bi-cake::before { content: "\f6e0"; }
|
||||
.bi-cake2::before { content: "\f6ed"; }
|
||||
.bi-cookie::before { content: "\f6ee"; }
|
||||
.bi-copy::before { content: "\f759"; }
|
||||
.bi-crosshair::before { content: "\f769"; }
|
||||
.bi-crosshair2::before { content: "\f794"; }
|
||||
.bi-emoji-astonished-fill::before { content: "\f795"; }
|
||||
.bi-emoji-astonished::before { content: "\f79a"; }
|
||||
.bi-emoji-grimace-fill::before { content: "\f79b"; }
|
||||
.bi-emoji-grimace::before { content: "\f7a0"; }
|
||||
.bi-emoji-grin-fill::before { content: "\f7a1"; }
|
||||
.bi-emoji-grin::before { content: "\f7a6"; }
|
||||
.bi-emoji-surprise-fill::before { content: "\f7a7"; }
|
||||
.bi-emoji-surprise::before { content: "\f7ac"; }
|
||||
.bi-emoji-tear-fill::before { content: "\f7ad"; }
|
||||
.bi-emoji-tear::before { content: "\f7b2"; }
|
||||
.bi-envelope-arrow-down-fill::before { content: "\f7b3"; }
|
||||
.bi-envelope-arrow-down::before { content: "\f7b8"; }
|
||||
.bi-envelope-arrow-up-fill::before { content: "\f7b9"; }
|
||||
.bi-envelope-arrow-up::before { content: "\f7be"; }
|
||||
.bi-feather::before { content: "\f7bf"; }
|
||||
.bi-feather2::before { content: "\f7c4"; }
|
||||
.bi-floppy-fill::before { content: "\f7c5"; }
|
||||
.bi-floppy::before { content: "\f7d8"; }
|
||||
.bi-floppy2-fill::before { content: "\f7d9"; }
|
||||
.bi-floppy2::before { content: "\f7e4"; }
|
||||
.bi-gitlab::before { content: "\f7e5"; }
|
||||
.bi-highlighter::before { content: "\f7f8"; }
|
||||
.bi-marker-tip::before { content: "\f802"; }
|
||||
.bi-nvme-fill::before { content: "\f803"; }
|
||||
.bi-nvme::before { content: "\f80c"; }
|
||||
.bi-opencollective::before { content: "\f80d"; }
|
||||
.bi-pci-card-network::before { content: "\f8cd"; }
|
||||
.bi-pci-card-sound::before { content: "\f8ce"; }
|
||||
.bi-radar::before { content: "\f8cf"; }
|
||||
.bi-send-arrow-down-fill::before { content: "\f8d0"; }
|
||||
.bi-send-arrow-down::before { content: "\f8d1"; }
|
||||
.bi-send-arrow-up-fill::before { content: "\f8d2"; }
|
||||
.bi-send-arrow-up::before { content: "\f8d3"; }
|
||||
.bi-sim-slash-fill::before { content: "\f8d4"; }
|
||||
.bi-sim-slash::before { content: "\f8d5"; }
|
||||
.bi-sourceforge::before { content: "\f8d6"; }
|
||||
.bi-substack::before { content: "\f8d7"; }
|
||||
.bi-threads-fill::before { content: "\f8d8"; }
|
||||
.bi-threads::before { content: "\f8d9"; }
|
||||
.bi-transparency::before { content: "\f8da"; }
|
||||
.bi-twitter-x::before { content: "\f8db"; }
|
||||
.bi-type-h4::before { content: "\f8dc"; }
|
||||
.bi-type-h5::before { content: "\f8dd"; }
|
||||
.bi-type-h6::before { content: "\f8de"; }
|
||||
.bi-backpack-fill::before { content: "\f8df"; }
|
||||
.bi-backpack::before { content: "\f8e0"; }
|
||||
.bi-backpack2-fill::before { content: "\f8e1"; }
|
||||
.bi-backpack2::before { content: "\f8e2"; }
|
||||
.bi-backpack3-fill::before { content: "\f8e3"; }
|
||||
.bi-backpack3::before { content: "\f8e4"; }
|
||||
.bi-backpack4-fill::before { content: "\f8e5"; }
|
||||
.bi-backpack4::before { content: "\f8e6"; }
|
||||
.bi-brilliance::before { content: "\f8e7"; }
|
||||
.bi-cake-fill::before { content: "\f8e8"; }
|
||||
.bi-cake2-fill::before { content: "\f8e9"; }
|
||||
.bi-duffle-fill::before { content: "\f8ea"; }
|
||||
.bi-duffle::before { content: "\f8eb"; }
|
||||
.bi-exposure::before { content: "\f8ec"; }
|
||||
.bi-gender-neuter::before { content: "\f8ed"; }
|
||||
.bi-highlights::before { content: "\f8ee"; }
|
||||
.bi-luggage-fill::before { content: "\f8ef"; }
|
||||
.bi-luggage::before { content: "\f8f0"; }
|
||||
.bi-mailbox-flag::before { content: "\f8f1"; }
|
||||
.bi-mailbox2-flag::before { content: "\f8f2"; }
|
||||
.bi-noise-reduction::before { content: "\f8f3"; }
|
||||
.bi-passport-fill::before { content: "\f8f4"; }
|
||||
.bi-passport::before { content: "\f8f5"; }
|
||||
.bi-person-arms-up::before { content: "\f8f6"; }
|
||||
.bi-person-raised-hand::before { content: "\f8f7"; }
|
||||
.bi-person-standing-dress::before { content: "\f8f8"; }
|
||||
.bi-person-standing::before { content: "\f8f9"; }
|
||||
.bi-person-walking::before { content: "\f8fa"; }
|
||||
.bi-person-wheelchair::before { content: "\f8fb"; }
|
||||
.bi-shadows::before { content: "\f8fc"; }
|
||||
.bi-suitcase-fill::before { content: "\f8fd"; }
|
||||
.bi-suitcase-lg-fill::before { content: "\f8fe"; }
|
||||
.bi-suitcase-lg::before { content: "\f8ff"; }
|
||||
.bi-suitcase::before { content: "\f900"; }
|
||||
.bi-suitcase2-fill::before { content: "\f901"; }
|
||||
.bi-suitcase2::before { content: "\f902"; }
|
||||
.bi-vignette::before { content: "\f903"; }
|
||||
|
|
12
_site/site_libs/bootstrap/bootstrap.min.css
vendored
6
_site/site_libs/bootstrap/bootstrap.min.js
vendored
21
_site/site_libs/htmltools-fill-0.5.8.1/fill.css
Normal file
|
@ -0,0 +1,21 @@
|
|||
@layer htmltools {
|
||||
.html-fill-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* Prevent the container from expanding vertically or horizontally beyond its
|
||||
parent's constraints. */
|
||||
min-height: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
.html-fill-container > .html-fill-item {
|
||||
/* Fill items can grow and shrink freely within
|
||||
available vertical space in fillable container */
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
.html-fill-container > :not(.html-fill-item) {
|
||||
/* Prevent shrinking or growing of non-fill items */
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
}
|
6
_site/site_libs/quarto-html/anchor.min.js
vendored
4
_site/site_libs/quarto-html/popper.min.js
vendored
|
@ -9,7 +9,7 @@ const layoutMarginEls = () => {
|
|||
// Find any conflicting margin elements and add margins to the
|
||||
// top to prevent overlap
|
||||
const marginChildren = window.document.querySelectorAll(
|
||||
".column-margin.column-container > * "
|
||||
".column-margin.column-container > *, .margin-caption, .aside"
|
||||
);
|
||||
|
||||
let lastBottom = 0;
|
||||
|
@ -18,25 +18,14 @@ const layoutMarginEls = () => {
|
|||
// clear the top margin so we recompute it
|
||||
marginChild.style.marginTop = null;
|
||||
const top = marginChild.getBoundingClientRect().top + window.scrollY;
|
||||
console.log({
|
||||
childtop: marginChild.getBoundingClientRect().top,
|
||||
scroll: window.scrollY,
|
||||
top,
|
||||
lastBottom,
|
||||
});
|
||||
if (top < lastBottom) {
|
||||
const margin = lastBottom - top;
|
||||
const marginChildStyle = window.getComputedStyle(marginChild);
|
||||
const marginBottom = parseFloat(marginChildStyle["marginBottom"]);
|
||||
const margin = lastBottom - top + marginBottom;
|
||||
marginChild.style.marginTop = `${margin}px`;
|
||||
}
|
||||
const styles = window.getComputedStyle(marginChild);
|
||||
const marginTop = parseFloat(styles["marginTop"]);
|
||||
|
||||
console.log({
|
||||
top,
|
||||
height: marginChild.getBoundingClientRect().height,
|
||||
marginTop,
|
||||
total: top + marginChild.getBoundingClientRect().height + marginTop,
|
||||
});
|
||||
lastBottom = top + marginChild.getBoundingClientRect().height + marginTop;
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +35,15 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
|||
// Recompute the position of margin elements anytime the body size changes
|
||||
if (window.ResizeObserver) {
|
||||
const resizeObserver = new window.ResizeObserver(
|
||||
throttle(layoutMarginEls, 50)
|
||||
throttle(() => {
|
||||
layoutMarginEls();
|
||||
if (
|
||||
window.document.body.getBoundingClientRect().width < 990 &&
|
||||
isReaderMode()
|
||||
) {
|
||||
quartoToggleReader();
|
||||
}
|
||||
}, 50)
|
||||
);
|
||||
resizeObserver.observe(window.document.body);
|
||||
}
|
||||
|
|
|
@ -85,6 +85,17 @@ window.document.addEventListener("DOMContentLoaded", function () {
|
|||
}
|
||||
}
|
||||
|
||||
function dashboardOffset() {
|
||||
const dashboardNavEl = window.document.getElementById(
|
||||
"quarto-dashboard-header"
|
||||
);
|
||||
if (dashboardNavEl !== null) {
|
||||
return dashboardNavEl.clientHeight;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function updateDocumentOffsetWithoutAnimation() {
|
||||
updateDocumentOffset(false);
|
||||
}
|
||||
|
@ -92,7 +103,7 @@ window.document.addEventListener("DOMContentLoaded", function () {
|
|||
function updateDocumentOffset(animated) {
|
||||
// set body offset
|
||||
const topOffset = headerOffset();
|
||||
const bodyOffset = topOffset + footerOffset();
|
||||
const bodyOffset = topOffset + footerOffset() + dashboardOffset();
|
||||
const bodyEl = window.document.body;
|
||||
bodyEl.setAttribute("data-bs-offset", topOffset);
|
||||
bodyEl.style.paddingTop = topOffset + "px";
|
||||
|
@ -205,9 +216,9 @@ window.document.addEventListener("DOMContentLoaded", function () {
|
|||
// Observe size changed for the header
|
||||
const headerEl = window.document.querySelector("header.fixed-top");
|
||||
if (headerEl && window.ResizeObserver) {
|
||||
const observer = new window.ResizeObserver(
|
||||
updateDocumentOffsetWithoutAnimation
|
||||
);
|
||||
const observer = new window.ResizeObserver(() => {
|
||||
setTimeout(updateDocumentOffsetWithoutAnimation, 0);
|
||||
});
|
||||
observer.observe(headerEl, {
|
||||
attributes: true,
|
||||
childList: true,
|
||||
|
@ -226,6 +237,7 @@ window.document.addEventListener("DOMContentLoaded", function () {
|
|||
const links = window.document.querySelectorAll("a");
|
||||
for (let i = 0; i < links.length; i++) {
|
||||
if (links[i].href) {
|
||||
links[i].dataset.originalHref = links[i].href;
|
||||
links[i].href = links[i].href.replace(/\/index\.html/, "/");
|
||||
}
|
||||
}
|
||||
|
@ -233,7 +245,7 @@ window.document.addEventListener("DOMContentLoaded", function () {
|
|||
// Fixup any sharing links that require urls
|
||||
// Append url to any sharing urls
|
||||
const sharingLinks = window.document.querySelectorAll(
|
||||
"a.sidebar-tools-main-item"
|
||||
"a.sidebar-tools-main-item, a.quarto-navigation-tool, a.quarto-navbar-tools, a.quarto-navbar-tools-item"
|
||||
);
|
||||
for (let i = 0; i < sharingLinks.length; i++) {
|
||||
const sharingLink = sharingLinks[i];
|
||||
|
|
|
@ -43,7 +43,7 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
|||
const mainEl = window.document.querySelector("main");
|
||||
|
||||
// highlight matches on the page
|
||||
if (query !== null && mainEl) {
|
||||
if (query && mainEl) {
|
||||
// perform any highlighting
|
||||
highlight(escapeRegExp(query), mainEl);
|
||||
|
||||
|
@ -57,7 +57,7 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
|||
// (e.g. if the user edits the query or clears it)
|
||||
let highlighting = true;
|
||||
const resetHighlighting = (searchTerm) => {
|
||||
if (mainEl && highlighting && query !== null && searchTerm !== query) {
|
||||
if (mainEl && highlighting && query && searchTerm !== query) {
|
||||
clearHighlight(query, mainEl);
|
||||
highlighting = false;
|
||||
}
|
||||
|
@ -98,6 +98,7 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
|||
classNames: {
|
||||
form: "d-flex",
|
||||
},
|
||||
placeholder: language["search-text-placeholder"],
|
||||
translations: {
|
||||
clearButtonTitle: language["search-clear-button-title"],
|
||||
detachedCancelButtonText: language["search-detached-cancel-button-title"],
|
||||
|
@ -110,6 +111,8 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
|||
return item.href;
|
||||
},
|
||||
onStateChange({ state }) {
|
||||
// If this is a file URL, note that
|
||||
|
||||
// Perhaps reset highlighting
|
||||
resetHighlighting(state.query);
|
||||
|
||||
|
@ -359,7 +362,8 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
|||
state,
|
||||
setActiveItemId,
|
||||
setContext,
|
||||
refresh
|
||||
refresh,
|
||||
quartoSearchOptions
|
||||
);
|
||||
},
|
||||
},
|
||||
|
@ -374,6 +378,32 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
|||
focusSearchInput();
|
||||
};
|
||||
|
||||
document.addEventListener("keyup", (event) => {
|
||||
const { key } = event;
|
||||
const kbds = quartoSearchOptions["keyboard-shortcut"];
|
||||
const focusedEl = document.activeElement;
|
||||
|
||||
const isFormElFocused = [
|
||||
"input",
|
||||
"select",
|
||||
"textarea",
|
||||
"button",
|
||||
"option",
|
||||
].find((tag) => {
|
||||
return focusedEl.tagName.toLowerCase() === tag;
|
||||
});
|
||||
|
||||
if (
|
||||
kbds &&
|
||||
kbds.includes(key) &&
|
||||
!isFormElFocused &&
|
||||
!document.activeElement.isContentEditable
|
||||
) {
|
||||
event.preventDefault();
|
||||
window.quartoOpenSearch();
|
||||
}
|
||||
});
|
||||
|
||||
// Remove the labeleledby attribute since it is pointing
|
||||
// to a non-existent label
|
||||
if (quartoSearchOptions.type === "overlay") {
|
||||
|
@ -385,11 +415,30 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
|
|||
}
|
||||
}
|
||||
|
||||
function throttle(func, wait) {
|
||||
let waiting = false;
|
||||
return function () {
|
||||
if (!waiting) {
|
||||
func.apply(this, arguments);
|
||||
waiting = true;
|
||||
setTimeout(function () {
|
||||
waiting = false;
|
||||
}, wait);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// If the main document scrolls dismiss the search results
|
||||
// (otherwise, since they're floating in the document they can scroll with the document)
|
||||
window.document.body.onscroll = () => {
|
||||
setIsOpen(false);
|
||||
};
|
||||
window.document.body.onscroll = throttle(() => {
|
||||
// Only do this if we're not detached
|
||||
// Bug #7117
|
||||
// This will happen when the keyboard is shown on ios (resulting in a scroll)
|
||||
// which then closed the search UI
|
||||
if (!window.matchMedia(detachedMediaQuery).matches) {
|
||||
setIsOpen(false);
|
||||
}
|
||||
}, 50);
|
||||
|
||||
if (showSearchResults) {
|
||||
setIsOpen(true);
|
||||
|
@ -429,15 +478,27 @@ function configurePlugins(quartoSearchOptions) {
|
|||
const algoliaInsightsPlugin = createAlgoliaInsightsPlugin({
|
||||
insightsClient: window.aa,
|
||||
onItemsChange({ insights, insightsEvents }) {
|
||||
const events = insightsEvents.map((event) => {
|
||||
const maxEvents = event.objectIDs.slice(0, 20);
|
||||
return {
|
||||
...event,
|
||||
objectIDs: maxEvents,
|
||||
};
|
||||
const events = insightsEvents.flatMap((event) => {
|
||||
// This API limits the number of items per event to 20
|
||||
const chunkSize = 20;
|
||||
const itemChunks = [];
|
||||
const eventItems = event.items;
|
||||
for (let i = 0; i < eventItems.length; i += chunkSize) {
|
||||
itemChunks.push(eventItems.slice(i, i + chunkSize));
|
||||
}
|
||||
// Split the items into multiple events that can be sent
|
||||
const events = itemChunks.map((items) => {
|
||||
return {
|
||||
...event,
|
||||
items,
|
||||
};
|
||||
});
|
||||
return events;
|
||||
});
|
||||
|
||||
insights.viewedObjectIDs(...events);
|
||||
for (const event of events) {
|
||||
insights.viewedObjectIDs(event);
|
||||
}
|
||||
},
|
||||
});
|
||||
return algoliaInsightsPlugin;
|
||||
|
@ -613,20 +674,30 @@ function showCopyLink(query, options) {
|
|||
/* Search Index Handling */
|
||||
// create the index
|
||||
var fuseIndex = undefined;
|
||||
var shownWarning = false;
|
||||
|
||||
// fuse index options
|
||||
const kFuseIndexOptions = {
|
||||
keys: [
|
||||
{ name: "title", weight: 20 },
|
||||
{ name: "section", weight: 20 },
|
||||
{ name: "text", weight: 10 },
|
||||
],
|
||||
ignoreLocation: true,
|
||||
threshold: 0.1,
|
||||
};
|
||||
|
||||
async function readSearchData() {
|
||||
// Initialize the search index on demand
|
||||
if (fuseIndex === undefined) {
|
||||
// create fuse index
|
||||
const options = {
|
||||
keys: [
|
||||
{ name: "title", weight: 20 },
|
||||
{ name: "section", weight: 20 },
|
||||
{ name: "text", weight: 10 },
|
||||
],
|
||||
ignoreLocation: true,
|
||||
threshold: 0.1,
|
||||
};
|
||||
const fuse = new window.Fuse([], options);
|
||||
if (window.location.protocol === "file:" && !shownWarning) {
|
||||
window.alert(
|
||||
"Search requires JavaScript features disabled when running in file://... URLs. In order to use search, please run this document in a web server."
|
||||
);
|
||||
shownWarning = true;
|
||||
return;
|
||||
}
|
||||
const fuse = new window.Fuse([], kFuseIndexOptions);
|
||||
|
||||
// fetch the main search.json
|
||||
const response = await fetch(offsetURL("search.json"));
|
||||
|
@ -646,6 +717,7 @@ async function readSearchData() {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
return fuseIndex;
|
||||
}
|
||||
|
||||
|
@ -674,7 +746,8 @@ function renderItem(
|
|||
state,
|
||||
setActiveItemId,
|
||||
setContext,
|
||||
refresh
|
||||
refresh,
|
||||
quartoSearchOptions
|
||||
) {
|
||||
switch (item.type) {
|
||||
case kItemTypeDoc:
|
||||
|
@ -684,7 +757,9 @@ function renderItem(
|
|||
item.title,
|
||||
item.section,
|
||||
item.text,
|
||||
item.href
|
||||
item.href,
|
||||
item.crumbs,
|
||||
quartoSearchOptions
|
||||
);
|
||||
case kItemTypeMore:
|
||||
return createMoreCard(
|
||||
|
@ -709,15 +784,46 @@ function renderItem(
|
|||
}
|
||||
}
|
||||
|
||||
function createDocumentCard(createElement, icon, title, section, text, href) {
|
||||
function createDocumentCard(
|
||||
createElement,
|
||||
icon,
|
||||
title,
|
||||
section,
|
||||
text,
|
||||
href,
|
||||
crumbs,
|
||||
quartoSearchOptions
|
||||
) {
|
||||
const iconEl = createElement("i", {
|
||||
class: `bi bi-${icon} search-result-icon`,
|
||||
});
|
||||
const titleEl = createElement("p", { class: "search-result-title" }, title);
|
||||
const titleContents = [iconEl, titleEl];
|
||||
const showParent = quartoSearchOptions["show-item-context"];
|
||||
if (crumbs && showParent) {
|
||||
let crumbsOut = undefined;
|
||||
const crumbClz = ["search-result-crumbs"];
|
||||
if (showParent === "root") {
|
||||
crumbsOut = crumbs.length > 1 ? crumbs[0] : undefined;
|
||||
} else if (showParent === "parent") {
|
||||
crumbsOut = crumbs.length > 1 ? crumbs[crumbs.length - 2] : undefined;
|
||||
} else {
|
||||
crumbsOut = crumbs.length > 1 ? crumbs.join(" > ") : undefined;
|
||||
crumbClz.push("search-result-crumbs-wrap");
|
||||
}
|
||||
|
||||
const crumbEl = createElement(
|
||||
"p",
|
||||
{ class: crumbClz.join(" ") },
|
||||
crumbsOut
|
||||
);
|
||||
titleContents.push(crumbEl);
|
||||
}
|
||||
|
||||
const titleContainerEl = createElement(
|
||||
"div",
|
||||
{ class: "search-result-title-container" },
|
||||
[iconEl, titleEl]
|
||||
titleContents
|
||||
);
|
||||
|
||||
const textEls = [];
|
||||
|
@ -1099,17 +1205,19 @@ function algoliaSearch(query, limit, algoliaOptions) {
|
|||
const remappedHits = response.hits.map((hit) => {
|
||||
return hit.map((item) => {
|
||||
const newItem = { ...item };
|
||||
["href", "section", "title", "text"].forEach((keyName) => {
|
||||
const mappedName = indexFields[keyName];
|
||||
if (
|
||||
mappedName &&
|
||||
item[mappedName] !== undefined &&
|
||||
mappedName !== keyName
|
||||
) {
|
||||
newItem[keyName] = item[mappedName];
|
||||
delete newItem[mappedName];
|
||||
["href", "section", "title", "text", "crumbs"].forEach(
|
||||
(keyName) => {
|
||||
const mappedName = indexFields[keyName];
|
||||
if (
|
||||
mappedName &&
|
||||
item[mappedName] !== undefined &&
|
||||
mappedName !== keyName
|
||||
) {
|
||||
newItem[keyName] = item[mappedName];
|
||||
delete newItem[mappedName];
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
newItem.text = highlightMatch(query, newItem.text);
|
||||
return newItem;
|
||||
});
|
||||
|
@ -1120,8 +1228,34 @@ function algoliaSearch(query, limit, algoliaOptions) {
|
|||
});
|
||||
}
|
||||
|
||||
function fuseSearch(query, fuse, fuseOptions) {
|
||||
return fuse.search(query, fuseOptions).map((result) => {
|
||||
let subSearchTerm = undefined;
|
||||
let subSearchFuse = undefined;
|
||||
const kFuseMaxWait = 125;
|
||||
|
||||
async function fuseSearch(query, fuse, fuseOptions) {
|
||||
let index = fuse;
|
||||
// Fuse.js using the Bitap algorithm for text matching which runs in
|
||||
// O(nm) time (no matter the structure of the text). In our case this
|
||||
// means that long search terms mixed with large index gets very slow
|
||||
//
|
||||
// This injects a subIndex that will be used once the terms get long enough
|
||||
// Usually making this subindex is cheap since there will typically be
|
||||
// a subset of results matching the existing query
|
||||
if (subSearchFuse !== undefined && query.startsWith(subSearchTerm)) {
|
||||
// Use the existing subSearchFuse
|
||||
index = subSearchFuse;
|
||||
} else if (subSearchFuse !== undefined) {
|
||||
// The term changed, discard the existing fuse
|
||||
subSearchFuse = undefined;
|
||||
subSearchTerm = undefined;
|
||||
}
|
||||
|
||||
// Search using the active fuse
|
||||
const then = performance.now();
|
||||
const resultsRaw = await index.search(query, fuseOptions);
|
||||
const now = performance.now();
|
||||
|
||||
const results = resultsRaw.map((result) => {
|
||||
const addParam = (url, name, value) => {
|
||||
const anchorParts = url.split("#");
|
||||
const baseUrl = anchorParts[0];
|
||||
|
@ -1135,6 +1269,18 @@ function fuseSearch(query, fuse, fuseOptions) {
|
|||
section: result.item.section,
|
||||
href: addParam(result.item.href, kQueryArg, query),
|
||||
text: highlightMatch(query, result.item.text),
|
||||
crumbs: result.item.crumbs,
|
||||
};
|
||||
});
|
||||
|
||||
// If we don't have a subfuse and the query is long enough, go ahead
|
||||
// and create a subfuse to use for subsequent queries
|
||||
if (now - then > kFuseMaxWait && subSearchFuse === undefined) {
|
||||
subSearchTerm = query;
|
||||
subSearchFuse = new window.Fuse([], kFuseIndexOptions);
|
||||
resultsRaw.forEach((rr) => {
|
||||
subSearchFuse.add(rr.item);
|
||||
});
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
|
56817
posts/2024-05-15-US-NHL-Birthrate/UNdata_Export_20240520_194600031.csv
Normal file
|
@ -1,17 +1,15 @@
|
|||
---
|
||||
title: "Does a US Born Players Birthdate affect their shot at the NHL"
|
||||
description: "Inspired by TidyTuesday Week 2 - 2024 dataset about Candian Players, lets look at the same anaylyis for American Born Players"
|
||||
date: "5/15/2024" #Update when live
|
||||
date: "6/08/2024" #Update when live
|
||||
categories:
|
||||
- tidytuesday
|
||||
- R
|
||||
- dataViz
|
||||
draft: TRUE
|
||||
---
|
||||
|
||||
```{r}
|
||||
#| include: false
|
||||
|
||||
knitr::read_chunk(here::here("posts", "2024-05-15-US-NHL-Birthrate", "nhl_usa_births.R"))
|
||||
|
||||
```
|
||||
|
@ -22,6 +20,7 @@ knitr::read_chunk(here::here("posts", "2024-05-15-US-NHL-Birthrate", "nhl_usa_bi
|
|||
#| warning: false
|
||||
#| message: false
|
||||
```
|
||||
|
||||
This post is inspired by this fantastic [blog post](https://jlaw.netlify.app/2023/12/04/are-birth-dates-still-destiny-for-canadian-nhl-players/) on Jlaws Blog. In it they explore how in the first chapter Malcolm Gladwell’s Outliers he discusses how in Canadian Junior Hockey there is a higher likelihood for players to be born in the first quarter of the year. As it appears cutoff dates for USA hockey are different and they are currently using June 1st (if my internet searches are to be believed), I wondered if the same analysis would hold true for American Born Players.
|
||||
|
||||
## Distribution of Births by Month in the United States
|
||||
|
@ -30,28 +29,58 @@ The data for US Birth Rates can be pulled from [CDC Wonder](https://wonder.cdc.g
|
|||
|
||||
```{r}
|
||||
#| label: USA_Birth_Data
|
||||
|
||||
```
|
||||
|
||||
### Graph Distribution of Births Compared to Expected
|
||||
### Distribution of Births Compared to Expected
|
||||
|
||||
note use of month.name to sort
|
||||
The data from CDC Wonder pulls in quite nice, the only addition is adding a column for expected Births. This column gives each day of each month an equal chance for a person being born. Based on the data the summer months (June through August), and September have a slightly higher actual birth vs expected. Based on cut off Dates many of these kids would be the oldest in their age groups.
|
||||
|
||||
```{r}
|
||||
#| label: USA_Distro
|
||||
|
||||
```
|
||||
|
||||
## Hockey Data
|
||||
|
||||
While I wish I could sit and type out how I sat and figured out the complexity of the NHL Stats API and how to bring it into R. In reality I took a great guide, that being Jlaws post, and tweaked what I needed. Instead of Canadian players, I pulled out just the US Born players and their birth dates. I did also pull out positions to see if that will make any sort of difference. What pulls out of the NHL API has a ton of great details and I look forward to diving into what is available to see what kind of graphics can be built.
|
||||
|
||||
```{r}
|
||||
#| label: Roster_Data
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Graph It
|
||||
|
||||
Lets now take a look at the graph. Using the ggimage package we can place nice logos for both the United States and NHL on the graph. This stands out quite nicely versus just using a colored point. Interesting enough the graph seems to show being born early on in the year may mean making the NHL is more likely.
|
||||
|
||||
```{r}
|
||||
#| label: Graph_It
|
||||
#| fig-height: 7
|
||||
#| fig-width: 7
|
||||
#| fig-height: 8
|
||||
#| fig-width: 10
|
||||
|
||||
```
|
||||
|
||||
If we look at this from a more stats based perspective, running a chi square test on the amount of players in the NHL per month, based on the US expected birth rate, we do see however there is quite a high p value. This is lets us know we can not reject the Null hypothesis that these are the same thing.
|
||||
|
||||
```{r}
|
||||
#| label: Stats
|
||||
```
|
||||
|
||||
# A Little Fun
|
||||
|
||||
For just a little bit of fun I pulled birth data for the entire world using the UN's website. I then filtered this out to just countries that currently have players in the NHL. The graph shows more of the same, looks to lean heavily to the beginning of the year, and this time the stat back it up. So being born early in the year may in fact help your chances of making it to the NHL
|
||||
|
||||
```{r}
|
||||
#| label: All_Players
|
||||
#| include: false
|
||||
```
|
||||
|
||||
|
||||
```{r}
|
||||
#| label: world_graph
|
||||
#| fig-height: 8
|
||||
#| fig-width: 10
|
||||
|
||||
```
|
|
@ -67,7 +67,7 @@ usa_roster <- purrr::map(teams$triCode, get_roster) %>%
|
|||
mob = lubridate::month(lubridate::ymd(birthDate), label = TRUE, abbr = FALSE)
|
||||
, mob_id = lubridate::month(lubridate::ymd(birthDate))
|
||||
) %>%
|
||||
dplyr::count(mob_id, mob, name = "players") %>%
|
||||
dplyr::count(mob_id, mob, name = "players") %>%
|
||||
dplyr::mutate(player_pct = players / sum(players))
|
||||
|
||||
## ---- Graph_It ----
|
||||
|
@ -85,23 +85,26 @@ combined <- usa_roster %>%
|
|||
)
|
||||
)
|
||||
|
||||
# labels <- combined %>% glue::glue_data("{mob} <br> n = {players}")
|
||||
|
||||
g1 <- combined %>%
|
||||
ggplot(aes(x = forcats::fct_reorder(mob, -mob_id))) +
|
||||
geom_line(aes(y = random, group = 1), linetype = 2, color = "grey60") +
|
||||
geom_linerange(aes(ymin = country_pct, ymax = player_pct)) +
|
||||
geom_image(aes(image = nhl_icon, y = player_pct)) +
|
||||
geom_image(aes(image = usa_icon, y = country_pct), size = 0.04) +
|
||||
geom_image(aes(image = nhl_icon, y = player_pct), size = 0.1) +
|
||||
geom_image(aes(image = usa_icon, y = country_pct), size = 0.08) +
|
||||
geom_text(aes(label = scales::percent(player_pct, accuracy = .1),
|
||||
y = dplyr::if_else(player_pct > country_pct, player_pct + .005, player_pct - .005))) +
|
||||
y = dplyr::if_else(player_pct > country_pct, player_pct + .006, player_pct - .006)), size = 5) +
|
||||
geom_text(aes(label = scales::percent(country_pct, accuracy = .1),
|
||||
y = dplyr::if_else(country_pct > player_pct, country_pct + .005, country_pct - .005))) +
|
||||
y = dplyr::if_else(country_pct > player_pct, country_pct + .006, country_pct - .006)), size = 5) +
|
||||
scale_y_continuous(labels = scales::percent) +
|
||||
# scale_x_discrete(labels = labels) +
|
||||
coord_flip() +
|
||||
labs(
|
||||
x = "Month of Birth"
|
||||
, y = "Percentage of Births"
|
||||
, title = "Are United States Born NHL Players More Likely to be Born Early in the Year?"
|
||||
, subtitle = "Comparing the distribution of birth months between Canadian NHL players and Canada in general"
|
||||
, subtitle = "Comparing the distribution of birth months between US NHL players and US in general"
|
||||
, caption = glue::glue(
|
||||
"<img src = {nhl_icon} width = '15' height=' 15' /> - US NHL Players Birth Month Distribution <br />
|
||||
<img src = {usa_icon} width = '15' height=' 15' /> - US Birth Month (2007-2022) Distribution"
|
||||
|
@ -110,7 +113,96 @@ g1 <- combined %>%
|
|||
theme_minimal() +
|
||||
theme(
|
||||
plot.caption = element_markdown()
|
||||
,plot.title.position = "plot"
|
||||
, plot.title.position = "plot"
|
||||
, text = element_text(size = 16)
|
||||
, axis.text = element_markdown()
|
||||
)
|
||||
|
||||
|
||||
g1
|
||||
|
||||
# Stats ----
|
||||
|
||||
broom::tidy(chisq.test(x = combined$players, p = combined$country_pct))
|
||||
|
||||
|
||||
## ---- All_Players ----
|
||||
|
||||
world_icon <- "https://cdn-icons-png.flaticon.com/512/921/921490.png"
|
||||
|
||||
country_codes_url <- "https://raw.githubusercontent.com/datasets/country-codes/master/data/country-codes.csv"
|
||||
|
||||
world_birth_rates_csv <- here::here("posts", "2024-05-15-US-NHL-Birthrate", "UNdata_Export_20240520_194600031.csv")
|
||||
|
||||
country_codes <- readr::read_csv(country_codes_url) %>%
|
||||
dplyr::select(official_name_en, `ISO3166-1-Alpha-3`)
|
||||
|
||||
world_roster_raw <- purrr::map(teams$triCode, get_roster) %>%
|
||||
purrr::list_rbind() %>%
|
||||
dplyr::filter(!is.na(firstName)) %>%
|
||||
dplyr::mutate(
|
||||
mob = lubridate::month(lubridate::ymd(birthDate), label = TRUE, abbr = FALSE)
|
||||
, mob_id = lubridate::month(lubridate::ymd(birthDate))
|
||||
)
|
||||
|
||||
codes_filter <- world_roster_raw %>% dplyr::distinct(birthCountry) %>% dplyr::pull()
|
||||
|
||||
country_filter <- country_codes %>%
|
||||
dplyr::filter(`ISO3166-1-Alpha-3` %in% codes_filter) %>%
|
||||
dplyr::pull(official_name_en)
|
||||
|
||||
world_births <- readr::read_csv(world_birth_rates_csv, name_repair = janitor::make_clean_names) %>%
|
||||
dplyr::filter(country_or_area %in% country_filter) %>%
|
||||
dplyr::filter(month %in% month.name) %>%
|
||||
dplyr::filter(reliability == "Final figure, complete") %>%
|
||||
dplyr::group_by(month) %>%
|
||||
dplyr::summarise(world_births = sum(value), .groups = "drop") %>%
|
||||
dplyr::mutate(world_pct = world_births / sum(world_births))
|
||||
|
||||
combined_world <- world_roster_raw %>%
|
||||
dplyr::count(mob_id, mob, name = "players") %>%
|
||||
dplyr::mutate(player_pct = players / sum(players)) %>%
|
||||
dplyr::left_join(world_births, by = c("mob" = "month")) %>%
|
||||
dplyr::mutate(
|
||||
random = dplyr::case_when(
|
||||
mob_id %in% c(4, 6, 9, 11) ~ 30 / 365,
|
||||
mob_id %in% c(1, 3, 5, 7, 8, 10, 12) ~ 31 / 365,
|
||||
mob_id == 2 ~ 28 / 365
|
||||
)
|
||||
)
|
||||
|
||||
# ---- world_graph ----
|
||||
|
||||
g2 <- combined_world %>%
|
||||
ggplot(aes(x = forcats::fct_reorder(mob, -mob_id))) +
|
||||
geom_line(aes(y = random, group = 1), linetype = 2, color = "grey60") +
|
||||
geom_linerange(aes(ymin = world_pct, ymax = player_pct)) +
|
||||
geom_image(aes(image = world_icon, y = world_pct), size = 0.08) +
|
||||
geom_image(aes(image = nhl_icon, y = player_pct), size = 0.1) +
|
||||
geom_text(aes(label = scales::percent(player_pct, accuracy = .1),
|
||||
y = dplyr::if_else(player_pct > world_pct, player_pct + .006, player_pct - .006)), size = 5) +
|
||||
geom_text(aes(label = scales::percent(world_pct, accuracy = .1),
|
||||
y = dplyr::if_else(world_pct > player_pct, world_pct + .006, world_pct - .006)), size = 5) +
|
||||
scale_y_continuous(labels = scales::percent) +
|
||||
coord_flip() +
|
||||
labs(
|
||||
x = "Month of Birth"
|
||||
, y = "Percentage of Births"
|
||||
, title = "What Birthday is most liekly to make the NHL?"
|
||||
, subtitle = "Comparing the distribution of birth months between All NHL players and the World in general"
|
||||
, caption = glue::glue(
|
||||
"<img src = {nhl_icon} width = '15' height=' 15' /> - US NHL Players Birth Month Distribution <br />
|
||||
<img src = {world_icon} width = '15' height=' 15' /> - World Birth Month (2007-2022) Distribution"
|
||||
)
|
||||
) +
|
||||
theme_minimal() +
|
||||
theme(
|
||||
plot.caption = element_markdown()
|
||||
, plot.title.position = "plot"
|
||||
, text = element_text(size = 16)
|
||||
, axis.text = element_markdown()
|
||||
)
|
||||
|
||||
g2
|
||||
|
||||
broom::tidy(chisq.test(x = combined_world$players, p = combined_world$world_pct))
|
||||
|
|
17
posts/2024-05-15-US-NHL-Birthrate/test.R
Normal file
|
@ -0,0 +1,17 @@
|
|||
|
||||
library(httr)
|
||||
library(jsonlite)
|
||||
|
||||
|
||||
username <- "Belanger"
|
||||
password <- "IHq186D77Pbg"
|
||||
|
||||
url = "https://opensky-network.org/api/flights/departure"
|
||||
|
||||
res = GET(
|
||||
"https://opensky-network.org/api/flights/departure",
|
||||
authenticate(user = username, password = password),
|
||||
query = list(airport = "KRDU", begin = 1717200000, end = 1717545600))
|
||||
|
||||
|
||||
data = fromJSON(rawToChar(res$content))
|