1304 lines
No EOL
124 KiB
HTML
1304 lines
No EOL
124 KiB
HTML
<!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.3.450">
|
||
|
||
<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="2020-06-25">
|
||
|
||
<title>Kyle Belanger - Diabetes in Rural North Carolina : Exploring Prevalence Trends</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 { display: inline-block; 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; }
|
||
}
|
||
/* CSS for citations */
|
||
div.csl-bib-body { }
|
||
div.csl-entry {
|
||
clear: both;
|
||
}
|
||
.hanging-indent div.csl-entry {
|
||
margin-left:2em;
|
||
text-indent:-2em;
|
||
}
|
||
div.csl-left-margin {
|
||
min-width:2em;
|
||
float:left;
|
||
}
|
||
div.csl-right-inline {
|
||
margin-left:2em;
|
||
padding-left:1em;
|
||
}
|
||
div.csl-indent {
|
||
margin-left: 2em;
|
||
}</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": 20,
|
||
"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-detached-cancel-button-title": "Cancel",
|
||
"search-submit-button-title": "Submit",
|
||
"search-label": "Search"
|
||
}
|
||
}</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 ">
|
||
<div class="navbar-container container-fluid">
|
||
<div class="navbar-brand-container">
|
||
<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" rel="" target="">
|
||
<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>
|
||
</li>
|
||
<li class="nav-item compact">
|
||
<a class="nav-link" href="https://github.com/mmmmtoasty19" rel="" target=""><i class="bi bi-github" role="img">
|
||
</i>
|
||
<span class="menu-text"></span></a>
|
||
</li>
|
||
</ul>
|
||
<div class="quarto-navbar-tools">
|
||
</div>
|
||
</div> <!-- /navcollapse -->
|
||
</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">Diabetes in Rural North Carolina : Exploring Prevalence Trends</h1>
|
||
<p class="subtitle lead"></p><p>This post introduces the exploration of the Diabetes epidemic in North Carolina</p><p></p>
|
||
</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 25, 2020</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 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="#update" id="toc-update" class="nav-link active" data-scroll-target="#update">Update</a></li>
|
||
<li><a href="#abstract" id="toc-abstract" class="nav-link" data-scroll-target="#abstract">Abstract</a></li>
|
||
<li><a href="#enviroment" id="toc-enviroment" class="nav-link" data-scroll-target="#enviroment">Enviroment</a></li>
|
||
<li><a href="#data" id="toc-data" class="nav-link" data-scroll-target="#data">Data</a></li>
|
||
<li><a href="#data-manipulation" id="toc-data-manipulation" class="nav-link" data-scroll-target="#data-manipulation">Data Manipulation</a>
|
||
<ul class="collapse">
|
||
<li><a href="#tweaks" id="toc-tweaks" class="nav-link" data-scroll-target="#tweaks">Tweaks</a></li>
|
||
<li><a href="#merge" id="toc-merge" class="nav-link" data-scroll-target="#merge">Merge</a></li>
|
||
</ul></li>
|
||
<li><a href="#overall---national-level" id="toc-overall---national-level" class="nav-link" data-scroll-target="#overall---national-level">Overall - National Level</a></li>
|
||
<li><a href="#overall---state-level" id="toc-overall---state-level" class="nav-link" data-scroll-target="#overall---state-level">Overall - State Level</a></li>
|
||
<li><a href="#overall---north-carolina" id="toc-overall---north-carolina" class="nav-link" data-scroll-target="#overall---north-carolina">Overall - North Carolina</a></li>
|
||
<li><a href="#by-county---geographical" id="toc-by-county---geographical" class="nav-link" data-scroll-target="#by-county---geographical">By County - Geographical</a></li>
|
||
<li><a href="#by-county---percent-change" id="toc-by-county---percent-change" class="nav-link" data-scroll-target="#by-county---percent-change">By County - Percent Change</a></li>
|
||
<li><a href="#conclusion-and-next-steps" id="toc-conclusion-and-next-steps" class="nav-link" data-scroll-target="#conclusion-and-next-steps">Conclusion and Next Steps</a></li>
|
||
<li><a href="#session-information" id="toc-session-information" class="nav-link" data-scroll-target="#session-information">Session information</a></li>
|
||
<li><a href="#references" id="toc-references" class="nav-link" data-scroll-target="#references">References</a></li>
|
||
</ul>
|
||
</nav>
|
||
</nav>
|
||
<div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"></div>
|
||
<!-- margin-sidebar -->
|
||
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
|
||
</div>
|
||
<!-- main -->
|
||
<main class="content quarto-banner-title-block page-columns page-full" id="quarto-document-content">
|
||
|
||
|
||
|
||
|
||
<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>
|
||
</section>
|
||
<section id="abstract" class="level1">
|
||
<h1>Abstract</h1>
|
||
<p>Diabetes is growing at an epidemic rate in the United States. In North Carolina alone, diabetes and prediabetes cost an estimated $10.9 billion each year <span class="citation" data-cites="ADA2015">(<a href="#ref-ADA2015" role="doc-biblioref">American Diabetes Asssociation, 2015</a>)</span>. This post introduces the exploration of the Diabetes epidemic in North Carolina. Through a series of posts this project will examine various public data available on diabetes and explore possible solutions to address the rise of diabetes in North Carolina. This investigation stems from the Capstone project of my Health Care Informatics Masters program. This post will answer the following questions:</p>
|
||
<blockquote class="blockquote">
|
||
<ol type="1">
|
||
<li>What is the overall trend of diabetes prevalence in the United States?</li>
|
||
</ol>
|
||
</blockquote>
|
||
<blockquote class="blockquote">
|
||
<ol start="2" type="1">
|
||
<li>What is the trend of diabetes at a State Level and how does diabetes prevalence vary by state and region?</li>
|
||
</ol>
|
||
</blockquote>
|
||
<blockquote class="blockquote">
|
||
<ol start="3" type="1">
|
||
<li>How do trends in diabetes prevalence vary across counties of North Carolina?</li>
|
||
</ol>
|
||
</blockquote>
|
||
<blockquote class="blockquote">
|
||
<ol start="4" type="1">
|
||
<li>In which counties of North Carolina does the largest change in diabetes prevalence occur?</li>
|
||
</ol>
|
||
</blockquote>
|
||
<blockquote class="blockquote">
|
||
<ol start="5" type="1">
|
||
<li>How does change in diabetes prevalence compare between rural and urban counties?</li>
|
||
</ol>
|
||
</blockquote>
|
||
</section>
|
||
<section id="enviroment" class="level1">
|
||
<h1>Enviroment</h1>
|
||
<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>
|
||
<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>
|
||
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(dplyr) <span class="co"># data wrangling</span></span>
|
||
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(ggplot2) <span class="co"># graphs</span></span>
|
||
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(tidyr) <span class="co"># data tidying</span></span>
|
||
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(maps)</span>
|
||
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(mapdata)</span>
|
||
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(sf)</span>
|
||
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(readr)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||
</details>
|
||
</div>
|
||
<p>Definitions of global object (file paths, factor levels, object groups ) used throughout the report.</p>
|
||
<div class="cell">
|
||
<details>
|
||
<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>
|
||
</details>
|
||
</div>
|
||
</section>
|
||
<section id="data" class="level1">
|
||
<h1>Data</h1>
|
||
<p>The data for this exploration comes from several sources:</p>
|
||
<ol type="1">
|
||
<li><p>The Diabetes data set for state and county levels were sourced from the US Diabetes Surveillance System; Division of Diabetes Translation - <a href="www.cdc.gov/diabetes/data">Centers for Disease Control and Prevention</a>. The data was downloaded one year per file, and compiled into a single data set for analysis.</p></li>
|
||
<li><p>The Diabetes data set for National level data were sourced from the CDC’s National Health Interview Survey <a href="https://www.cdc.gov/nchs/nhis/index.htm">(NHIS)</a></p></li>
|
||
<li><p>The list of rural counties was taken from The Office of Rural Health Policy, the list is available <a href="https://www.hrsa.gov/sites/default/files/hrsa/ruralhealth/resources/forhpeligibleareas.pdf">here</a></p></li>
|
||
</ol>
|
||
<!-- Load the datasets. -->
|
||
<div class="cell">
|
||
<details>
|
||
<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>
|
||
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a>nc_diabetes_data_raw <span class="ot"><-</span> <span class="fu">read_csv</span>(<span class="st">"https://raw.githubusercontent.com/mmmmtoasty19/nc-diabetes-epidemic-2020/62bdaa6971fbdff09214de7c013d40122abbe40d/data-public/derived/nc-diabetes-data.csv"</span>) <span class="sc">%>%</span> </span>
|
||
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">rename_all</span>(tolower)</span>
|
||
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a>us_diabetes_data_raw <span class="ot"><-</span> <span class="fu">read_csv</span>(<span class="st">"https://github.com/mmmmtoasty19/nc-diabetes-epidemic-2020/raw/62bdaa6971fbdff09214de7c013d40122abbe40d/data-public/raw/us_diabetes_totals.csv"</span></span>
|
||
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a> ,<span class="at">skip =</span> <span class="dv">2</span>)</span>
|
||
<span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb3-9"><a href="#cb3-9" aria-hidden="true" tabindex="-1"></a>rural_counties <span class="ot"><-</span> <span class="fu">read_csv</span>(<span class="st">"https://github.com/mmmmtoasty19/nc-diabetes-epidemic-2020/raw/b29bfd93b20b73a7000d349cb3b55fd0822afe76/data-public/metadata/rural-counties.csv"</span>)</span>
|
||
<span id="cb3-10"><a href="#cb3-10" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb3-11"><a href="#cb3-11" aria-hidden="true" tabindex="-1"></a>county_centers_raw <span class="ot"><-</span> <span class="fu">read_csv</span>(<span class="st">"https://github.com/mmmmtoasty19/nc-diabetes-epidemic-2020/raw/b29bfd93b20b73a7000d349cb3b55fd0822afe76/data-public/raw/nc_county_centers.csv"</span>, <span class="at">col_names =</span> <span class="fu">c</span>(<span class="st">"county"</span>, <span class="st">"lat"</span>,<span class="st">"long"</span>))</span>
|
||
<span id="cb3-12"><a href="#cb3-12" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb3-13"><a href="#cb3-13" aria-hidden="true" tabindex="-1"></a>diabetes_atlas_data_raw <span class="ot"><-</span> <span class="fu">read_csv</span>(<span class="st">"https://raw.githubusercontent.com/mmmmtoasty19/nc-diabetes-epidemic-2020/b29bfd93b20b73a7000d349cb3b55fd0822afe76/data-public/raw/DiabetesAtlasData.csv"</span></span>
|
||
<span id="cb3-14"><a href="#cb3-14" aria-hidden="true" tabindex="-1"></a> ,<span class="at">col_types =</span> <span class="fu">cols</span>(<span class="at">LowerLimit =</span> <span class="fu">col_skip</span>(), </span>
|
||
<span id="cb3-15"><a href="#cb3-15" aria-hidden="true" tabindex="-1"></a> <span class="at">UpperLimit =</span> <span class="fu">col_skip</span>(),</span>
|
||
<span id="cb3-16"><a href="#cb3-16" aria-hidden="true" tabindex="-1"></a> <span class="at">Percentage =</span> <span class="fu">col_double</span>()), <span class="at">skip =</span> <span class="dv">2</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||
</details>
|
||
</div>
|
||
<!-- load map data -->
|
||
<div class="cell">
|
||
<details>
|
||
<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>
|
||
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a>nc_counties_map_raw <span class="ot"><-</span> <span class="fu">st_as_sf</span>(<span class="fu">map</span>(<span class="st">"county"</span>,<span class="at">region =</span> <span class="st">"north carolina"</span>, <span class="at">plot =</span> <span class="cn">FALSE</span>,<span class="at">fill =</span> <span class="cn">TRUE</span>)) <span class="sc">%>%</span> </span>
|
||
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate_at</span>(<span class="st">"ID"</span>, <span class="sc">~</span>stringr<span class="sc">::</span><span class="fu">str_remove</span>(.,<span class="st">"north carolina,"</span>))</span>
|
||
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a>state_map_raw <span class="ot"><-</span> <span class="fu">st_as_sf</span>(<span class="fu">map</span>(<span class="st">"state"</span>,<span class="at">plot =</span> <span class="cn">FALSE</span>,<span class="at">fill =</span> <span class="cn">TRUE</span> ))</span>
|
||
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a>nc_cities <span class="ot"><-</span> <span class="fu">st_as_sf</span>(<span class="fu">read_csv</span>(<span class="st">"https://github.com/mmmmtoasty19/nc-diabetes-epidemic-2020/raw/b29bfd93b20b73a7000d349cb3b55fd0822afe76/data-public/metadata/nc_cities.csv"</span>),</span>
|
||
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a> <span class="at">coords =</span> <span class="fu">c</span>(<span class="st">"long"</span>, <span class="st">"lat"</span>)</span>
|
||
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a> ,<span class="at">remove =</span> <span class="cn">FALSE</span></span>
|
||
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a> ,<span class="at">agr =</span> <span class="st">"constant"</span></span>
|
||
<span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a> ,<span class="at">crs =</span> <span class="dv">4326</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||
</details>
|
||
</div>
|
||
</section>
|
||
<section id="data-manipulation" class="level1">
|
||
<h1>Data Manipulation</h1>
|
||
<p>The combined data used in this anaylsis can be downloaded <a href="https://github.com/mmmmtoasty19/nc-diabetes-epidemic-2020/blob/master/data-public/derived/nc-diabetes-data.csv">here</a>. The only tweaks done here are to combine the rural counties column, and the data for creating maps.</p>
|
||
<section id="tweaks" class="level3">
|
||
<h3 class="anchored" data-anchor-id="tweaks">Tweaks</h3>
|
||
<!-- Tweak the datasets. -->
|
||
<div class="cell">
|
||
<details>
|
||
<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>
|
||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">c</span>(<span class="st">"</span><span class="sc">\\</span><span class="st">°"</span> <span class="ot">=</span> <span class="st">""</span></span>
|
||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> ,<span class="st">"</span><span class="sc">\\</span><span class="st">+"</span> <span class="ot">=</span> <span class="st">""</span></span>
|
||
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a> ,<span class="st">"</span><span class="sc">\\</span><span class="st">–"</span> <span class="ot">=</span> <span class="st">"-"</span></span>
|
||
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a> ) </span>
|
||
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">%>%</span></span>
|
||
<span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="fu">across</span>(<span class="fu">c</span>(<span class="st">"lat"</span>,<span class="st">"long"</span>), <span class="sc">~</span><span class="fu">iconv</span>(.,<span class="at">from =</span> <span class="st">'UTF-8'</span>, <span class="at">to =</span> <span class="st">'ASCII//TRANSLIT'</span>))</span>
|
||
<span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a> ,<span class="fu">across</span>(<span class="fu">c</span>(<span class="st">"lat"</span>,<span class="st">"long"</span>),<span class="sc">~</span>stringr<span class="sc">::</span><span class="fu">str_remove_all</span>(.,<span class="st">"</span><span class="sc">\\</span><span class="st">?"</span>))) <span class="sc">%>%</span> </span>
|
||
<span id="cb5-11"><a href="#cb5-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate_at</span>(<span class="fu">c</span>(<span class="st">"lat"</span>,<span class="st">"long"</span>),as.numeric) <span class="sc">%>%</span></span>
|
||
<span id="cb5-12"><a href="#cb5-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="fu">across</span>(<span class="st">"long"</span>, <span class="sc">~</span>(. <span class="sc">*</span> <span class="sc">-</span><span class="dv">1</span>))) <span class="sc">%>%</span> </span>
|
||
<span id="cb5-13"><a href="#cb5-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate_at</span>(<span class="st">"county"</span>, tolower)</span>
|
||
<span id="cb5-14"><a href="#cb5-14" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb5-15"><a href="#cb5-15" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb5-16"><a href="#cb5-16" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb5-17"><a href="#cb5-17" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb5-18"><a href="#cb5-18" aria-hidden="true" tabindex="-1"></a>us_diabetes_data <span class="ot"><-</span> us_diabetes_data_raw <span class="sc">%>%</span> </span>
|
||
<span id="cb5-19"><a href="#cb5-19" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(Year <span class="sc">>=</span> <span class="dv">2000</span>) <span class="sc">%>%</span> </span>
|
||
<span id="cb5-20"><a href="#cb5-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">select</span>( <span class="st">"Year"</span>,<span class="st">"Total - Percentage"</span>) <span class="sc">%>%</span> </span>
|
||
<span id="cb5-21"><a href="#cb5-21" aria-hidden="true" tabindex="-1"></a> <span class="fu">rename</span>(<span class="at">year =</span> Year , <span class="at">us_pct =</span> <span class="st">`</span><span class="at">Total - Percentage</span><span class="st">`</span>)</span>
|
||
<span id="cb5-22"><a href="#cb5-22" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb5-23"><a href="#cb5-23" aria-hidden="true" tabindex="-1"></a>diabetes_atlas_data <span class="ot"><-</span> diabetes_atlas_data_raw <span class="sc">%>%</span> </span>
|
||
<span id="cb5-24"><a href="#cb5-24" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate_at</span>(<span class="st">"State"</span>, tolower) <span class="sc">%>%</span> </span>
|
||
<span id="cb5-25"><a href="#cb5-25" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(Year <span class="sc">>=</span> <span class="dv">2000</span>)</span>
|
||
<span id="cb5-26"><a href="#cb5-26" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb5-27"><a href="#cb5-27" aria-hidden="true" tabindex="-1"></a>state_map_abb <span class="ot"><-</span> state_map_raw <span class="sc">%>%</span> </span>
|
||
<span id="cb5-28"><a href="#cb5-28" aria-hidden="true" tabindex="-1"></a> <span class="fu">left_join</span>(<span class="fu">read_csv</span>(<span class="st">"https://github.com/mmmmtoasty19/nc-diabetes-epidemic-2020/raw/b29bfd93b20b73a7000d349cb3b55fd0822afe76/data-public/metadata/state-abb.csv"</span>) <span class="sc">%>%</span> </span>
|
||
<span id="cb5-29"><a href="#cb5-29" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate_at</span>(<span class="st">"state"</span>, tolower)</span>
|
||
<span id="cb5-30"><a href="#cb5-30" aria-hidden="true" tabindex="-1"></a> ,<span class="at">by =</span> <span class="fu">c</span>(<span class="st">"ID"</span> <span class="ot">=</span> <span class="st">"state"</span>) )</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||
</details>
|
||
</div>
|
||
</section>
|
||
<section id="merge" class="level3">
|
||
<h3 class="anchored" data-anchor-id="merge">Merge</h3>
|
||
<!-- Merge datasets -->
|
||
<div class="cell">
|
||
<details>
|
||
<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>
|
||
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a>nc_diabetes_data <span class="ot"><-</span> nc_diabetes_data_raw <span class="sc">%>%</span> </span>
|
||
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate_at</span>(<span class="st">"county"</span>, <span class="sc">~</span>stringr<span class="sc">::</span><span class="fu">str_replace_all</span>(.,<span class="st">"Mcdowell"</span>,<span class="st">"McDowell"</span>)) <span class="sc">%>%</span> </span>
|
||
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(</span>
|
||
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a> <span class="at">rural =</span> county <span class="sc">%in%</span> rural_counties<span class="sc">$</span>rural_counties</span>
|
||
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">%>%</span> </span>
|
||
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate_at</span>(<span class="st">"county"</span>,tolower) <span class="sc">%>%</span> </span>
|
||
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">left_join</span>(us_diabetes_data)</span>
|
||
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb6-11"><a href="#cb6-11" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb6-12"><a href="#cb6-12" aria-hidden="true" tabindex="-1"></a>nc_counties_map <span class="ot"><-</span> nc_counties_map_raw <span class="sc">%>%</span> </span>
|
||
<span id="cb6-13"><a href="#cb6-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">left_join</span>(nc_diabetes_data, <span class="at">by =</span> <span class="fu">c</span>(<span class="st">"ID"</span> <span class="ot">=</span> <span class="st">"county"</span>)) <span class="sc">%>%</span> </span>
|
||
<span id="cb6-14"><a href="#cb6-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">left_join</span>(county_centers, <span class="at">by =</span> <span class="fu">c</span>(<span class="st">"ID"</span> <span class="ot">=</span> <span class="st">"county"</span>)) <span class="sc">%>%</span> </span>
|
||
<span id="cb6-15"><a href="#cb6-15" aria-hidden="true" tabindex="-1"></a> <span class="fu">rename</span>(</span>
|
||
<span id="cb6-16"><a href="#cb6-16" aria-hidden="true" tabindex="-1"></a> <span class="at">center_long =</span> long</span>
|
||
<span id="cb6-17"><a href="#cb6-17" aria-hidden="true" tabindex="-1"></a> ,<span class="at">center_lat =</span> lat)</span>
|
||
<span id="cb6-18"><a href="#cb6-18" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb6-19"><a href="#cb6-19" aria-hidden="true" tabindex="-1"></a>state_map <span class="ot"><-</span> state_map_abb <span class="sc">%>%</span> </span>
|
||
<span id="cb6-20"><a href="#cb6-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">left_join</span>(diabetes_atlas_data, <span class="at">by =</span> <span class="fu">c</span>(<span class="st">"ID"</span> <span class="ot">=</span> <span class="st">"State"</span>)) <span class="sc">%>%</span> </span>
|
||
<span id="cb6-21"><a href="#cb6-21" aria-hidden="true" tabindex="-1"></a> <span class="fu">rename_all</span>(tolower)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||
</details>
|
||
</div>
|
||
</section>
|
||
</section>
|
||
<section id="overall---national-level" class="level1">
|
||
<h1>Overall - National Level</h1>
|
||
<div class="cell">
|
||
<details>
|
||
<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>
|
||
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a> <span class="at">change =</span> <span class="fu">lead</span>(us_pct) <span class="sc">-</span> us_pct</span>
|
||
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a> ,<span class="at">change =</span> <span class="fu">if_else</span>(change <span class="sc">></span> <span class="dv">0</span>, <span class="cn">TRUE</span>, <span class="cn">FALSE</span>)</span>
|
||
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">%>%</span> </span>
|
||
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate_at</span>(<span class="st">"change"</span>, <span class="sc">~</span>stringr<span class="sc">::</span><span class="fu">str_replace_na</span>(.,<span class="st">"NA"</span>))</span>
|
||
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true" tabindex="-1"></a>o_g1 <span class="ot"><-</span> us_diabetes_data <span class="sc">%>%</span> </span>
|
||
<span id="cb7-11"><a href="#cb7-11" 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> us_pct)) <span class="sc">+</span></span>
|
||
<span id="cb7-12"><a href="#cb7-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_line</span>(<span class="at">color=</span> <span class="st">"#D95F02"</span>) <span class="sc">+</span></span>
|
||
<span id="cb7-13"><a href="#cb7-13" aria-hidden="true" tabindex="-1"></a> <span class="co"># geom_line(aes(color = change, group = 1)) +</span></span>
|
||
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_point</span>(<span class="at">shape =</span> <span class="dv">21</span>, <span class="at">size =</span> <span class="dv">3</span>,<span class="at">color=</span> <span class="st">"#D95F02"</span>) <span class="sc">+</span></span>
|
||
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a> <span class="co"># geom_point(aes(color = change),shape = 21, size = 3) +</span></span>
|
||
<span id="cb7-16"><a href="#cb7-16" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_color_manual</span>(<span class="at">values =</span> <span class="fu">c</span>(</span>
|
||
<span id="cb7-17"><a href="#cb7-17" aria-hidden="true" tabindex="-1"></a> <span class="st">"TRUE"</span> <span class="ot">=</span> <span class="st">"#D95F02"</span></span>
|
||
<span id="cb7-18"><a href="#cb7-18" aria-hidden="true" tabindex="-1"></a> ,<span class="st">"FALSE"</span> <span class="ot">=</span> <span class="st">"#7570B3"</span></span>
|
||
<span id="cb7-19"><a href="#cb7-19" aria-hidden="true" tabindex="-1"></a> ), <span class="at">guide =</span> <span class="cn">FALSE</span>) <span class="sc">+</span></span>
|
||
<span id="cb7-20"><a href="#cb7-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span>
|
||
<span id="cb7-21"><a href="#cb7-21" aria-hidden="true" tabindex="-1"></a> <span class="at">title =</span> <span class="st">"Percentage of Diagnosed Diabetes in Adults (18+), National Level"</span></span>
|
||
<span id="cb7-22"><a href="#cb7-22" aria-hidden="true" tabindex="-1"></a> ,<span class="at">x =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb7-23"><a href="#cb7-23" aria-hidden="true" tabindex="-1"></a> ,<span class="at">y =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb7-24"><a href="#cb7-24" aria-hidden="true" tabindex="-1"></a> ,<span class="at">caption =</span> <span class="st">"Note: Data from the CDC's National Health Interview Survey (NHIS)"</span></span>
|
||
<span id="cb7-25"><a href="#cb7-25" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb7-26"><a href="#cb7-26" aria-hidden="true" tabindex="-1"></a></span>
|
||
<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>
|
||
</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>
|
||
</section>
|
||
<section id="overall---state-level" class="level1">
|
||
<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>
|
||
<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>
|
||
<span id="cb8-3"><a href="#cb8-3" 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="at">color =</span> region)) <span class="sc">+</span></span>
|
||
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_line</span>(<span class="fu">aes</span>(<span class="at">group =</span> id ),<span class="at">alpha =</span> <span class="fl">0.3</span>,<span class="at">na.rm =</span> <span class="cn">TRUE</span>) <span class="sc">+</span></span>
|
||
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_smooth</span>(<span class="at">method =</span> <span class="st">"lm"</span>, <span class="at">se =</span> <span class="cn">FALSE</span>) <span class="sc">+</span></span>
|
||
<span id="cb8-6"><a href="#cb8-6" aria-hidden="true" tabindex="-1"></a> ggpmisc<span class="sc">::</span><span class="fu">stat_poly_eq</span>(<span class="at">formula =</span> y <span class="sc">~</span> <span class="sc">+</span> x ,</span>
|
||
<span id="cb8-7"><a href="#cb8-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span>(<span class="at">label =</span> <span class="fu">paste</span>(..eq.label.., ..rr.label.., <span class="at">sep =</span> <span class="st">"~~~"</span>)), </span>
|
||
<span id="cb8-8"><a href="#cb8-8" aria-hidden="true" tabindex="-1"></a> <span class="at">parse =</span> <span class="cn">TRUE</span>) <span class="sc">+</span></span>
|
||
<span id="cb8-9"><a href="#cb8-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_vline</span>(<span class="at">xintercept =</span> <span class="dv">2011</span>, <span class="at">linetype =</span> <span class="st">"dashed"</span>, <span class="at">color =</span> <span class="st">"gray"</span>) <span class="sc">+</span></span>
|
||
<span id="cb8-10"><a href="#cb8-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_color_brewer</span>(<span class="at">palette =</span> <span class="st">"Dark2"</span></span>
|
||
<span id="cb8-11"><a href="#cb8-11" aria-hidden="true" tabindex="-1"></a> ,<span class="at">direction =</span> <span class="sc">-</span><span class="dv">1</span></span>
|
||
<span id="cb8-12"><a href="#cb8-12" aria-hidden="true" tabindex="-1"></a> ,<span class="at">labels =</span> snakecase<span class="sc">::</span>to_title_case</span>
|
||
<span id="cb8-13"><a href="#cb8-13" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span>
|
||
<span id="cb8-14"><a href="#cb8-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span>
|
||
<span id="cb8-15"><a href="#cb8-15" aria-hidden="true" tabindex="-1"></a> <span class="at">title =</span> <span class="st">"Percentage of Diagnosed Diabetes in Adults (18+) </span><span class="sc">\n</span><span class="st">by State and Region"</span></span>
|
||
<span id="cb8-16"><a href="#cb8-16" aria-hidden="true" tabindex="-1"></a> ,<span class="at">x =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb8-17"><a href="#cb8-17" aria-hidden="true" tabindex="-1"></a> ,<span class="at">y =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb8-18"><a href="#cb8-18" aria-hidden="true" tabindex="-1"></a> ,<span class="at">color =</span> <span class="st">"Region"</span></span>
|
||
<span id="cb8-19"><a href="#cb8-19" aria-hidden="true" tabindex="-1"></a> ,<span class="at">caption =</span> <span class="st">"Regions from US Census Bureau"</span></span>
|
||
<span id="cb8-20"><a href="#cb8-20" aria-hidden="true" tabindex="-1"></a> ) </span>
|
||
<span id="cb8-21"><a href="#cb8-21" aria-hidden="true" tabindex="-1"></a></span>
|
||
<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>
|
||
</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>
|
||
<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>
|
||
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(region <span class="sc">==</span> <span class="st">"south"</span>) <span class="sc">%>%</span> </span>
|
||
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate_at</span>(<span class="st">"id"</span>, <span class="sc">~</span>snakecase<span class="sc">::</span><span class="fu">to_title_case</span>(.)) <span class="sc">%>%</span> </span>
|
||
<span id="cb9-5"><a href="#cb9-5" 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>
|
||
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_line</span>(<span class="fu">aes</span>(<span class="at">group =</span> id ),<span class="at">na.rm =</span> <span class="cn">TRUE</span>, <span class="at">color=</span> <span class="st">"#D95F02"</span>) <span class="sc">+</span></span>
|
||
<span id="cb9-7"><a href="#cb9-7" aria-hidden="true" tabindex="-1"></a> gghighlight<span class="sc">::</span><span class="fu">gghighlight</span>(id <span class="sc">==</span> <span class="st">"North Carolina"</span>, <span class="at">label_params =</span> <span class="fu">list</span>(<span class="at">vjust =</span> <span class="dv">3</span>)) <span class="sc">+</span></span>
|
||
<span id="cb9-8"><a href="#cb9-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_y_continuous</span>(<span class="at">breaks =</span> <span class="fu">seq</span>(<span class="dv">5</span>,<span class="dv">13</span>,<span class="dv">2</span>)) <span class="sc">+</span></span>
|
||
<span id="cb9-9"><a href="#cb9-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_x_continuous</span>(<span class="at">minor_breaks =</span> <span class="fu">seq</span>(<span class="dv">2000</span>,<span class="dv">2016</span>,<span class="dv">1</span>)) <span class="sc">+</span></span>
|
||
<span id="cb9-10"><a href="#cb9-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span>
|
||
<span id="cb9-11"><a href="#cb9-11" aria-hidden="true" tabindex="-1"></a> <span class="at">title =</span> <span class="st">"Percentage of Diagnosed Diabetes in Adults (18+) </span><span class="sc">\n</span><span class="st">South Region"</span></span>
|
||
<span id="cb9-12"><a href="#cb9-12" aria-hidden="true" tabindex="-1"></a> ,<span class="at">x =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb9-13"><a href="#cb9-13" aria-hidden="true" tabindex="-1"></a> ,<span class="at">y =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb9-14"><a href="#cb9-14" aria-hidden="true" tabindex="-1"></a> ,<span class="at">caption =</span> <span class="st">"Regions from US Census Bureau"</span></span>
|
||
<span id="cb9-15"><a href="#cb9-15" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span>
|
||
<span id="cb9-16"><a href="#cb9-16" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme</span>()</span>
|
||
<span id="cb9-17"><a href="#cb9-17" aria-hidden="true" tabindex="-1"></a></span>
|
||
<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>
|
||
</div>
|
||
<p>When focusing on the south region, North Carolina falls close to the middle of diabetes prevalence.</p>
|
||
</section>
|
||
<section id="overall---north-carolina" class="level1">
|
||
<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>
|
||
<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>
|
||
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">summarise</span>(</span>
|
||
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a> <span class="at">pct =</span> <span class="fu">mean</span>(percentage)</span>
|
||
<span id="cb10-5"><a href="#cb10-5" aria-hidden="true" tabindex="-1"></a> ,<span class="at">us_pct =</span> <span class="fu">mean</span>(us_pct)</span>
|
||
<span id="cb10-6"><a href="#cb10-6" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">%>%</span> </span>
|
||
<span id="cb10-7"><a href="#cb10-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_longer</span>(</span>
|
||
<span id="cb10-8"><a href="#cb10-8" aria-hidden="true" tabindex="-1"></a> <span class="at">cols =</span> <span class="fu">c</span>(<span class="st">"pct"</span>, <span class="st">"us_pct"</span>)</span>
|
||
<span id="cb10-9"><a href="#cb10-9" aria-hidden="true" tabindex="-1"></a> ,<span class="at">names_to =</span> <span class="st">"metric"</span></span>
|
||
<span id="cb10-10"><a href="#cb10-10" aria-hidden="true" tabindex="-1"></a> ,<span class="at">values_to =</span> <span class="st">"values"</span></span>
|
||
<span id="cb10-11"><a href="#cb10-11" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">%>%</span> </span>
|
||
<span id="cb10-12"><a href="#cb10-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(</span>
|
||
<span id="cb10-13"><a href="#cb10-13" aria-hidden="true" tabindex="-1"></a> <span class="at">metric =</span> <span class="fu">factor</span>(metric</span>
|
||
<span id="cb10-14"><a href="#cb10-14" aria-hidden="true" tabindex="-1"></a> ,<span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"pct"</span>,<span class="st">"us_pct"</span>)</span>
|
||
<span id="cb10-15"><a href="#cb10-15" aria-hidden="true" tabindex="-1"></a> ,<span class="at">labels =</span> <span class="fu">c</span>(<span class="st">"NC"</span>, <span class="st">"National"</span>))</span>
|
||
<span id="cb10-16"><a href="#cb10-16" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb10-17"><a href="#cb10-17" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb10-18"><a href="#cb10-18" aria-hidden="true" tabindex="-1"></a>nc_g1 <span class="ot"><-</span> d1 <span class="sc">%>%</span> </span>
|
||
<span id="cb10-19"><a href="#cb10-19" 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> values, <span class="at">color =</span> metric)) <span class="sc">+</span></span>
|
||
<span id="cb10-20"><a href="#cb10-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_line</span>() <span class="sc">+</span></span>
|
||
<span id="cb10-21"><a href="#cb10-21" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_point</span>(<span class="at">shape =</span> <span class="dv">21</span>, <span class="at">size =</span> <span class="dv">3</span>) <span class="sc">+</span></span>
|
||
<span id="cb10-22"><a href="#cb10-22" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_vline</span>(<span class="at">xintercept =</span> <span class="dv">2011</span>, <span class="at">linetype =</span> <span class="st">"dashed"</span>, <span class="at">color =</span> <span class="st">"gray"</span>) <span class="sc">+</span></span>
|
||
<span id="cb10-23"><a href="#cb10-23" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_y_continuous</span>(<span class="at">labels =</span> <span class="cf">function</span>(x) <span class="fu">paste0</span>(x, <span class="st">"%"</span>)) <span class="sc">+</span></span>
|
||
<span id="cb10-24"><a href="#cb10-24" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_color_brewer</span>(<span class="at">palette =</span> <span class="st">"Dark2"</span>) <span class="sc">+</span></span>
|
||
<span id="cb10-25"><a href="#cb10-25" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span>
|
||
<span id="cb10-26"><a href="#cb10-26" aria-hidden="true" tabindex="-1"></a> <span class="at">x =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb10-27"><a href="#cb10-27" aria-hidden="true" tabindex="-1"></a> ,<span class="at">y =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb10-28"><a href="#cb10-28" aria-hidden="true" tabindex="-1"></a> ,<span class="at">color =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb10-29"><a href="#cb10-29" aria-hidden="true" tabindex="-1"></a> ,<span class="at">title =</span> <span class="st">"Percent of Adults (20+) with Diagnosed Diabetes"</span></span>
|
||
<span id="cb10-30"><a href="#cb10-30" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb10-31"><a href="#cb10-31" aria-hidden="true" tabindex="-1"></a></span>
|
||
<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>
|
||
</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>
|
||
<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>
|
||
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_line</span>(<span class="fu">aes</span>(<span class="at">group =</span> county),<span class="at">alpha =</span> <span class="fl">0.4</span>) <span class="sc">+</span></span>
|
||
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span>
|
||
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a> <span class="at">x =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a> ,<span class="at">y =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a> ,<span class="at">color =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb11-9"><a href="#cb11-9" aria-hidden="true" tabindex="-1"></a></span>
|
||
<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>
|
||
</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>
|
||
<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>
|
||
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(</span>
|
||
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a> <span class="at">pct_rural =</span> <span class="fu">if_else</span>(rural <span class="sc">==</span> <span class="cn">TRUE</span>, percentage, <span class="cn">FALSE</span>)</span>
|
||
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a> ,<span class="at">pct_urban =</span> <span class="fu">if_else</span>(rural <span class="sc">==</span> <span class="cn">FALSE</span>, percentage, <span class="cn">FALSE</span>)</span>
|
||
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">%>%</span> </span>
|
||
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">select</span>(<span class="sc">-</span>countyfips,<span class="sc">-</span>percentage) <span class="sc">%>%</span> </span>
|
||
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">group_by</span>(year) <span class="sc">%>%</span> </span>
|
||
<span id="cb12-9"><a href="#cb12-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">summarise</span>(</span>
|
||
<span id="cb12-10"><a href="#cb12-10" aria-hidden="true" tabindex="-1"></a> <span class="at">pct_rural =</span> <span class="fu">mean</span>(pct_rural,<span class="at">na.rm =</span> <span class="cn">TRUE</span>)</span>
|
||
<span id="cb12-11"><a href="#cb12-11" aria-hidden="true" tabindex="-1"></a> ,<span class="at">pct_urban =</span> <span class="fu">mean</span>(pct_urban,<span class="at">na.rm =</span> <span class="cn">TRUE</span>)</span>
|
||
<span id="cb12-12"><a href="#cb12-12" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">%>%</span> <span class="fu">left_join</span>(us_diabetes_data) <span class="sc">%>%</span> </span>
|
||
<span id="cb12-13"><a href="#cb12-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_longer</span>(</span>
|
||
<span id="cb12-14"><a href="#cb12-14" aria-hidden="true" tabindex="-1"></a> <span class="at">cols =</span> <span class="fu">c</span>(<span class="st">"us_pct"</span>, <span class="st">"pct_rural"</span>,<span class="st">"pct_urban"</span>)</span>
|
||
<span id="cb12-15"><a href="#cb12-15" aria-hidden="true" tabindex="-1"></a> ,<span class="at">names_to =</span> <span class="st">"metric"</span></span>
|
||
<span id="cb12-16"><a href="#cb12-16" aria-hidden="true" tabindex="-1"></a> ,<span class="at">values_to =</span> <span class="st">"value"</span></span>
|
||
<span id="cb12-17"><a href="#cb12-17" aria-hidden="true" tabindex="-1"></a> ,<span class="at">values_drop_na =</span> <span class="cn">TRUE</span></span>
|
||
<span id="cb12-18"><a href="#cb12-18" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">%>%</span> </span>
|
||
<span id="cb12-19"><a href="#cb12-19" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(</span>
|
||
<span id="cb12-20"><a href="#cb12-20" aria-hidden="true" tabindex="-1"></a> <span class="at">metric =</span> <span class="fu">factor</span>(metric,</span>
|
||
<span id="cb12-21"><a href="#cb12-21" aria-hidden="true" tabindex="-1"></a> <span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"pct_rural"</span>,<span class="st">"pct_urban"</span>,<span class="st">"us_pct"</span>)</span>
|
||
<span id="cb12-22"><a href="#cb12-22" aria-hidden="true" tabindex="-1"></a> ,<span class="at">labels =</span> <span class="fu">c</span>(<span class="st">"Rural"</span>,<span class="st">"Urban"</span>,<span class="st">"US"</span>)</span>
|
||
<span id="cb12-23"><a href="#cb12-23" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb12-24"><a href="#cb12-24" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb12-25"><a href="#cb12-25" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb12-26"><a href="#cb12-26" aria-hidden="true" tabindex="-1"></a>nc_g2 <span class="ot"><-</span> d2 <span class="sc">%>%</span> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x =</span> year, <span class="at">y =</span> value, <span class="at">color =</span> metric)) <span class="sc">+</span></span>
|
||
<span id="cb12-27"><a href="#cb12-27" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_line</span>() <span class="sc">+</span></span>
|
||
<span id="cb12-28"><a href="#cb12-28" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_point</span>(<span class="at">shape =</span> <span class="dv">21</span>, <span class="at">size =</span> <span class="dv">3</span>) <span class="sc">+</span></span>
|
||
<span id="cb12-29"><a href="#cb12-29" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_vline</span>(<span class="at">xintercept =</span> <span class="dv">2011</span>, <span class="at">linetype =</span> <span class="st">"dashed"</span>, <span class="at">color =</span> <span class="st">"gray"</span>) <span class="sc">+</span></span>
|
||
<span id="cb12-30"><a href="#cb12-30" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_y_continuous</span>(<span class="at">labels =</span> <span class="cf">function</span>(x) <span class="fu">paste0</span>(x, <span class="st">"%"</span>)) <span class="sc">+</span></span>
|
||
<span id="cb12-31"><a href="#cb12-31" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_color_brewer</span>(<span class="at">palette =</span> <span class="st">"Dark2"</span>) <span class="sc">+</span></span>
|
||
<span id="cb12-32"><a href="#cb12-32" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span>
|
||
<span id="cb12-33"><a href="#cb12-33" aria-hidden="true" tabindex="-1"></a> <span class="at">x =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb12-34"><a href="#cb12-34" aria-hidden="true" tabindex="-1"></a> ,<span class="at">y =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb12-35"><a href="#cb12-35" aria-hidden="true" tabindex="-1"></a> ,<span class="at">color =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb12-36"><a href="#cb12-36" aria-hidden="true" tabindex="-1"></a> ,<span class="at">title =</span> <span class="st">"Percent of Adults (20+) with Diagnosed Diabetes </span><span class="sc">\n</span><span class="st">Displaying Rural vs Urban"</span></span>
|
||
<span id="cb12-37"><a href="#cb12-37" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb12-38"><a href="#cb12-38" aria-hidden="true" tabindex="-1"></a></span>
|
||
<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>
|
||
</div>
|
||
</section>
|
||
<section id="by-county---geographical" class="level1 page-columns page-full">
|
||
<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>
|
||
<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>
|
||
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(</span>
|
||
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a> <span class="at">rural =</span> <span class="fu">factor</span>(rural</span>
|
||
<span id="cb13-5"><a href="#cb13-5" aria-hidden="true" tabindex="-1"></a> ,<span class="at">levels =</span> <span class="fu">c</span>(<span class="cn">TRUE</span>,<span class="cn">FALSE</span>)</span>
|
||
<span id="cb13-6"><a href="#cb13-6" aria-hidden="true" tabindex="-1"></a> ,<span class="at">labels =</span> <span class="fu">c</span>(<span class="st">"Rural"</span>, <span class="st">"Urban"</span>)</span>
|
||
<span id="cb13-7"><a href="#cb13-7" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb13-8"><a href="#cb13-8" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">%>%</span> </span>
|
||
<span id="cb13-9"><a href="#cb13-9" 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="at">color =</span> rural)) <span class="sc">+</span></span>
|
||
<span id="cb13-10"><a href="#cb13-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_line</span>(<span class="fu">aes</span>(<span class="at">group =</span> county),<span class="at">alpha =</span> <span class="fl">0.3</span>) <span class="sc">+</span></span>
|
||
<span id="cb13-11"><a href="#cb13-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_smooth</span>(<span class="fu">aes</span>(<span class="at">group =</span> rural), <span class="at">method =</span> <span class="st">"loess"</span>, <span class="at">se=</span> <span class="cn">FALSE</span>, <span class="at">size =</span> <span class="fl">1.1</span>) <span class="sc">+</span></span>
|
||
<span id="cb13-12"><a href="#cb13-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_color_brewer</span>(<span class="at">palette =</span> <span class="st">"Dark2"</span>) <span class="sc">+</span></span>
|
||
<span id="cb13-13"><a href="#cb13-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span>
|
||
<span id="cb13-14"><a href="#cb13-14" aria-hidden="true" tabindex="-1"></a> <span class="at">title =</span> <span class="st">"Percent of Adults (20+) with Diagnosed Diabetes </span><span class="sc">\n</span><span class="st">All North Carolina Counties"</span></span>
|
||
<span id="cb13-15"><a href="#cb13-15" aria-hidden="true" tabindex="-1"></a> ,<span class="at">x =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb13-16"><a href="#cb13-16" aria-hidden="true" tabindex="-1"></a> ,<span class="at">y =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb13-17"><a href="#cb13-17" aria-hidden="true" tabindex="-1"></a> ,<span class="at">color =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb13-18"><a href="#cb13-18" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb13-19"><a href="#cb13-19" aria-hidden="true" tabindex="-1"></a></span>
|
||
<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>
|
||
</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>
|
||
<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>
|
||
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(</span>
|
||
<span id="cb14-4"><a href="#cb14-4" aria-hidden="true" tabindex="-1"></a> <span class="at">bin =</span> dlookr<span class="sc">::</span><span class="fu">binning</span>(.<span class="sc">$</span>percentage, <span class="at">nbins =</span> <span class="dv">6</span> ,<span class="at">type =</span> <span class="st">"equal"</span>)</span>
|
||
<span id="cb14-5"><a href="#cb14-5" aria-hidden="true" tabindex="-1"></a> ,<span class="at">bin =</span> forcats<span class="sc">::</span><span class="fu">fct_recode</span>(bin</span>
|
||
<span id="cb14-6"><a href="#cb14-6" aria-hidden="true" tabindex="-1"></a> ,<span class="st">"6.5 - 7.9"</span> <span class="ot">=</span> <span class="st">"[6.5,7.97]"</span></span>
|
||
<span id="cb14-7"><a href="#cb14-7" aria-hidden="true" tabindex="-1"></a> ,<span class="st">"8.0 - 9.4"</span> <span class="ot">=</span> <span class="st">"(7.97,9.43]"</span> </span>
|
||
<span id="cb14-8"><a href="#cb14-8" aria-hidden="true" tabindex="-1"></a> ,<span class="st">"9.5 - 10.9"</span> <span class="ot">=</span> <span class="st">"(9.43,10.9]"</span> </span>
|
||
<span id="cb14-9"><a href="#cb14-9" aria-hidden="true" tabindex="-1"></a> ,<span class="st">"11.0 - 12.4"</span> <span class="ot">=</span> <span class="st">"(10.9,12.4]"</span></span>
|
||
<span id="cb14-10"><a href="#cb14-10" aria-hidden="true" tabindex="-1"></a> ,<span class="st">"12.5 - 13.8"</span> <span class="ot">=</span> <span class="st">"(12.4,13.8]"</span> </span>
|
||
<span id="cb14-11"><a href="#cb14-11" aria-hidden="true" tabindex="-1"></a> ,<span class="st">"13.9 - 15.3"</span> <span class="ot">=</span> <span class="st">"(13.8,15.3]"</span></span>
|
||
<span id="cb14-12"><a href="#cb14-12" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb14-13"><a href="#cb14-13" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb14-14"><a href="#cb14-14" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb14-15"><a href="#cb14-15" aria-hidden="true" tabindex="-1"></a>c_g1 <span class="ot"><-</span> nc_counties_map_binned <span class="sc">%>%</span> </span>
|
||
<span id="cb14-16"><a href="#cb14-16" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(year <span class="sc">%in%</span> <span class="fu">c</span>(<span class="dv">2006</span>,<span class="dv">2014</span>)) <span class="sc">%>%</span> </span>
|
||
<span id="cb14-17"><a href="#cb14-17" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>() <span class="sc">+</span></span>
|
||
<span id="cb14-18"><a href="#cb14-18" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>() <span class="sc">+</span> <span class="co">#blank geom_sf keeps gridlines from overlapping map</span></span>
|
||
<span id="cb14-19"><a href="#cb14-19" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="fu">aes</span>(<span class="at">fill =</span> bin,<span class="at">color =</span> rural)) <span class="sc">+</span></span>
|
||
<span id="cb14-20"><a href="#cb14-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="at">data =</span> nc_cities) <span class="sc">+</span></span>
|
||
<span id="cb14-21"><a href="#cb14-21" aria-hidden="true" tabindex="-1"></a> ggrepel<span class="sc">::</span><span class="fu">geom_text_repel</span>(<span class="at">data =</span> nc_cities, </span>
|
||
<span id="cb14-22"><a href="#cb14-22" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span>(<span class="at">x =</span> long, <span class="at">y =</span> lat, <span class="at">label =</span> city)</span>
|
||
<span id="cb14-23"><a href="#cb14-23" aria-hidden="true" tabindex="-1"></a> ,<span class="at">nudge_y =</span> <span class="fu">c</span>(<span class="sc">-</span><span class="dv">1</span>,<span class="dv">1</span>,<span class="dv">1</span>,<span class="sc">-</span><span class="dv">1</span>,<span class="dv">1</span>)</span>
|
||
<span id="cb14-24"><a href="#cb14-24" aria-hidden="true" tabindex="-1"></a> ,<span class="at">nudge_x =</span> <span class="fu">c</span>(<span class="dv">0</span>,<span class="dv">0</span>,<span class="dv">0</span>,<span class="sc">-</span><span class="dv">1</span>,<span class="dv">0</span>)</span>
|
||
<span id="cb14-25"><a href="#cb14-25" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span>
|
||
<span id="cb14-26"><a href="#cb14-26" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_text</span>(<span class="at">data =</span> . <span class="sc">%>%</span> <span class="fu">filter</span>(rural <span class="sc">==</span> <span class="cn">TRUE</span>)</span>
|
||
<span id="cb14-27"><a href="#cb14-27" aria-hidden="true" tabindex="-1"></a> ,<span class="fu">aes</span>(<span class="at">x =</span> center_long, <span class="at">y =</span> center_lat)</span>
|
||
<span id="cb14-28"><a href="#cb14-28" aria-hidden="true" tabindex="-1"></a> ,<span class="at">label =</span> <span class="st">"R"</span></span>
|
||
<span id="cb14-29"><a href="#cb14-29" aria-hidden="true" tabindex="-1"></a> ,<span class="at">color =</span> <span class="st">"#696969"</span></span>
|
||
<span id="cb14-30"><a href="#cb14-30" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span>
|
||
<span id="cb14-31"><a href="#cb14-31" aria-hidden="true" tabindex="-1"></a> <span class="fu">coord_sf</span>(<span class="at">xlim =</span> <span class="fu">c</span>(<span class="sc">-</span><span class="fl">84.5</span>,<span class="sc">-</span><span class="fl">75.5</span>), <span class="at">ylim =</span> <span class="fu">c</span>(<span class="fl">33.75</span>,<span class="dv">37</span>)) <span class="sc">+</span></span>
|
||
<span id="cb14-32"><a href="#cb14-32" aria-hidden="true" tabindex="-1"></a> <span class="fu">facet_wrap</span>(<span class="sc">~</span>year) <span class="sc">+</span></span>
|
||
<span id="cb14-33"><a href="#cb14-33" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_fill_viridis_d</span>(<span class="at">alpha =</span> <span class="fl">0.6</span>, <span class="at">direction =</span> <span class="sc">-</span><span class="dv">1</span>) <span class="sc">+</span></span>
|
||
<span id="cb14-34"><a href="#cb14-34" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_color_manual</span>(</span>
|
||
<span id="cb14-35"><a href="#cb14-35" aria-hidden="true" tabindex="-1"></a> <span class="at">values =</span> <span class="fu">c</span>(</span>
|
||
<span id="cb14-36"><a href="#cb14-36" aria-hidden="true" tabindex="-1"></a> <span class="st">"FALSE"</span> <span class="ot">=</span> <span class="st">"gray"</span></span>
|
||
<span id="cb14-37"><a href="#cb14-37" aria-hidden="true" tabindex="-1"></a> ,<span class="st">"TRUE"</span> <span class="ot">=</span> <span class="st">"black"</span></span>
|
||
<span id="cb14-38"><a href="#cb14-38" aria-hidden="true" tabindex="-1"></a> ),<span class="at">guide =</span> <span class="st">'none'</span>) <span class="sc">+</span></span>
|
||
<span id="cb14-39"><a href="#cb14-39" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span>
|
||
<span id="cb14-40"><a href="#cb14-40" aria-hidden="true" tabindex="-1"></a> <span class="at">title =</span> <span class="st">"Estimated Diabetes in Adults (20+) by County"</span></span>
|
||
<span id="cb14-41"><a href="#cb14-41" aria-hidden="true" tabindex="-1"></a> ,<span class="at">fill =</span> <span class="st">"Percentage"</span></span>
|
||
<span id="cb14-42"><a href="#cb14-42" aria-hidden="true" tabindex="-1"></a> ,<span class="at">y =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb14-43"><a href="#cb14-43" aria-hidden="true" tabindex="-1"></a> ,<span class="at">x =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb14-44"><a href="#cb14-44" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span>
|
||
<span id="cb14-45"><a href="#cb14-45" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme</span>(</span>
|
||
<span id="cb14-46"><a href="#cb14-46" aria-hidden="true" tabindex="-1"></a> <span class="at">panel.background =</span> <span class="fu">element_rect</span>(<span class="at">fill =</span> <span class="st">"aliceblue"</span>)</span>
|
||
<span id="cb14-47"><a href="#cb14-47" aria-hidden="true" tabindex="-1"></a> ,<span class="at">panel.grid.major =</span> <span class="fu">element_line</span>(<span class="at">color =</span> <span class="st">"#D4D4D4"</span>, <span class="at">linetype =</span> <span class="st">"dashed"</span>, </span>
|
||
<span id="cb14-48"><a href="#cb14-48" aria-hidden="true" tabindex="-1"></a> <span class="at">size =</span> <span class="fl">0.5</span>)</span>
|
||
<span id="cb14-49"><a href="#cb14-49" aria-hidden="true" tabindex="-1"></a> ,<span class="at">legend.position =</span> <span class="st">"bottom"</span></span>
|
||
<span id="cb14-50"><a href="#cb14-50" aria-hidden="true" tabindex="-1"></a> ,<span class="at">plot.title =</span> <span class="fu">element_text</span>(<span class="at">hjust =</span> <span class="fl">0.5</span>)</span>
|
||
<span id="cb14-51"><a href="#cb14-51" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<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>
|
||
</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>
|
||
<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>
|
||
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a> <span class="at">rural =</span> <span class="fu">factor</span>(rural</span>
|
||
<span id="cb15-4"><a href="#cb15-4" aria-hidden="true" tabindex="-1"></a> ,<span class="at">levels =</span> <span class="fu">c</span>(<span class="cn">TRUE</span>,<span class="cn">FALSE</span>)</span>
|
||
<span id="cb15-5"><a href="#cb15-5" aria-hidden="true" tabindex="-1"></a> ,<span class="at">labels =</span> <span class="fu">c</span>(<span class="st">"Rural"</span>, <span class="st">"Urban"</span>)</span>
|
||
<span id="cb15-6"><a href="#cb15-6" aria-hidden="true" tabindex="-1"></a> )) <span class="sc">%>%</span> </span>
|
||
<span id="cb15-7"><a href="#cb15-7" 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>
|
||
<span id="cb15-8"><a href="#cb15-8" 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="at">group =</span> <span class="fu">interaction</span>(year,rural), <span class="at">fill =</span> rural)) <span class="sc">+</span></span>
|
||
<span id="cb15-9"><a href="#cb15-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_boxplot</span>(<span class="at">alpha =</span> <span class="fl">0.5</span>) <span class="sc">+</span></span>
|
||
<span id="cb15-10"><a href="#cb15-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_fill_brewer</span>(<span class="at">palette =</span> <span class="st">"Dark2"</span>) <span class="sc">+</span></span>
|
||
<span id="cb15-11"><a href="#cb15-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_x_continuous</span>(<span class="at">breaks =</span> <span class="fu">seq</span>(<span class="dv">2004</span>,<span class="dv">2014</span>,<span class="dv">2</span>)) <span class="sc">+</span></span>
|
||
<span id="cb15-12"><a href="#cb15-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span>
|
||
<span id="cb15-13"><a href="#cb15-13" aria-hidden="true" tabindex="-1"></a> <span class="at">x =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb15-14"><a href="#cb15-14" aria-hidden="true" tabindex="-1"></a> ,<span class="at">y =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb15-15"><a href="#cb15-15" aria-hidden="true" tabindex="-1"></a> ,<span class="at">fill =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb15-16"><a href="#cb15-16" aria-hidden="true" tabindex="-1"></a> ,<span class="at">title =</span> <span class="st">"Distribution of Estimated Cases by County 2006 - 2014"</span></span>
|
||
<span id="cb15-17"><a href="#cb15-17" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb15-18"><a href="#cb15-18" aria-hidden="true" tabindex="-1"></a></span>
|
||
<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>
|
||
</div>
|
||
</section>
|
||
<section id="by-county---percent-change" class="level1">
|
||
<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>
|
||
<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>
|
||
<span id="cb16-3"><a href="#cb16-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(year <span class="sc">%in%</span> <span class="fu">c</span>(<span class="dv">2006</span>,<span class="dv">2014</span>)) <span class="sc">%>%</span> </span>
|
||
<span id="cb16-4"><a href="#cb16-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">select</span>(<span class="sc">-</span>countyfips,<span class="sc">-</span>us_pct) <span class="sc">%>%</span> </span>
|
||
<span id="cb16-5"><a href="#cb16-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_wider</span>(<span class="at">names_from =</span> <span class="st">"year"</span></span>
|
||
<span id="cb16-6"><a href="#cb16-6" aria-hidden="true" tabindex="-1"></a> ,<span class="at">values_from =</span> <span class="st">"percentage"</span>) <span class="sc">%>%</span> </span>
|
||
<span id="cb16-7"><a href="#cb16-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(</span>
|
||
<span id="cb16-8"><a href="#cb16-8" aria-hidden="true" tabindex="-1"></a> <span class="at">pct_p =</span> <span class="st">`</span><span class="at">2014</span><span class="st">`</span> <span class="sc">-</span> <span class="st">`</span><span class="at">2006</span><span class="st">`</span></span>
|
||
<span id="cb16-9"><a href="#cb16-9" aria-hidden="true" tabindex="-1"></a> ,<span class="at">pct_c =</span> ((<span class="st">`</span><span class="at">2014</span><span class="st">`</span> <span class="sc">-</span> <span class="st">`</span><span class="at">2006</span><span class="st">`</span>)<span class="sc">/</span><span class="st">`</span><span class="at">2006</span><span class="st">`</span>) <span class="sc">*</span> <span class="dv">100</span></span>
|
||
<span id="cb16-10"><a href="#cb16-10" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">%>%</span> </span>
|
||
<span id="cb16-11"><a href="#cb16-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">left_join</span>(nc_counties_map_raw) <span class="sc">%>%</span> </span>
|
||
<span id="cb16-12"><a href="#cb16-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">st_as_sf</span>()</span>
|
||
<span id="cb16-13"><a href="#cb16-13" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb16-14"><a href="#cb16-14" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb16-15"><a href="#cb16-15" aria-hidden="true" tabindex="-1"></a>c_g4 <span class="ot"><-</span> d3 <span class="sc">%>%</span> </span>
|
||
<span id="cb16-16"><a href="#cb16-16" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>() <span class="sc">+</span></span>
|
||
<span id="cb16-17"><a href="#cb16-17" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>() <span class="sc">+</span> <span class="co">#blank geom_sf keeps gridlines from overlapping map</span></span>
|
||
<span id="cb16-18"><a href="#cb16-18" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="fu">aes</span>(<span class="at">fill =</span> pct_c ,<span class="at">color =</span> rural)) <span class="sc">+</span></span>
|
||
<span id="cb16-19"><a href="#cb16-19" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="at">data =</span> nc_cities) <span class="sc">+</span></span>
|
||
<span id="cb16-20"><a href="#cb16-20" aria-hidden="true" tabindex="-1"></a> ggrepel<span class="sc">::</span><span class="fu">geom_text_repel</span>(<span class="at">data =</span> nc_cities, </span>
|
||
<span id="cb16-21"><a href="#cb16-21" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span>(<span class="at">x =</span> long, <span class="at">y =</span> lat, <span class="at">label =</span> city)</span>
|
||
<span id="cb16-22"><a href="#cb16-22" aria-hidden="true" tabindex="-1"></a> ,<span class="at">nudge_y =</span> <span class="fu">c</span>(<span class="sc">-</span><span class="dv">1</span>,<span class="dv">1</span>,<span class="dv">1</span>,<span class="sc">-</span><span class="dv">1</span>,<span class="dv">1</span>)</span>
|
||
<span id="cb16-23"><a href="#cb16-23" aria-hidden="true" tabindex="-1"></a> ,<span class="at">nudge_x =</span> <span class="fu">c</span>(<span class="dv">0</span>,<span class="dv">0</span>,<span class="dv">0</span>,<span class="sc">-</span><span class="dv">1</span>,<span class="dv">0</span>)</span>
|
||
<span id="cb16-24"><a href="#cb16-24" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span>
|
||
<span id="cb16-25"><a href="#cb16-25" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_text</span>(<span class="at">data =</span> . <span class="sc">%>%</span> <span class="fu">filter</span>(rural <span class="sc">==</span> <span class="cn">TRUE</span>)</span>
|
||
<span id="cb16-26"><a href="#cb16-26" aria-hidden="true" tabindex="-1"></a> ,<span class="fu">aes</span>(<span class="at">x =</span> center_long, <span class="at">y =</span> center_lat)</span>
|
||
<span id="cb16-27"><a href="#cb16-27" aria-hidden="true" tabindex="-1"></a> ,<span class="at">label =</span> <span class="st">"R"</span></span>
|
||
<span id="cb16-28"><a href="#cb16-28" aria-hidden="true" tabindex="-1"></a> ,<span class="at">color =</span> <span class="st">"#696969"</span></span>
|
||
<span id="cb16-29"><a href="#cb16-29" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span>
|
||
<span id="cb16-30"><a href="#cb16-30" aria-hidden="true" tabindex="-1"></a> <span class="co"># scale_fill_viridis_c(alpha = 0.6, direction = -1) +</span></span>
|
||
<span id="cb16-31"><a href="#cb16-31" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_fill_gradient2</span>(</span>
|
||
<span id="cb16-32"><a href="#cb16-32" aria-hidden="true" tabindex="-1"></a> <span class="at">low =</span> <span class="st">"#d01c8b"</span></span>
|
||
<span id="cb16-33"><a href="#cb16-33" aria-hidden="true" tabindex="-1"></a> ,<span class="at">mid =</span> <span class="st">"#f7f7f7"</span></span>
|
||
<span id="cb16-34"><a href="#cb16-34" aria-hidden="true" tabindex="-1"></a> ,<span class="at">high =</span> <span class="st">"#4dac26"</span></span>
|
||
<span id="cb16-35"><a href="#cb16-35" aria-hidden="true" tabindex="-1"></a> ,<span class="at">midpoint =</span> <span class="dv">0</span></span>
|
||
<span id="cb16-36"><a href="#cb16-36" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span>
|
||
<span id="cb16-37"><a href="#cb16-37" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_color_manual</span>(</span>
|
||
<span id="cb16-38"><a href="#cb16-38" aria-hidden="true" tabindex="-1"></a> <span class="at">values =</span> <span class="fu">c</span>(</span>
|
||
<span id="cb16-39"><a href="#cb16-39" aria-hidden="true" tabindex="-1"></a> <span class="st">"FALSE"</span> <span class="ot">=</span> <span class="st">"gray"</span></span>
|
||
<span id="cb16-40"><a href="#cb16-40" aria-hidden="true" tabindex="-1"></a> ,<span class="st">"TRUE"</span> <span class="ot">=</span> <span class="st">"black"</span></span>
|
||
<span id="cb16-41"><a href="#cb16-41" aria-hidden="true" tabindex="-1"></a> ),<span class="at">guide =</span> <span class="st">'none'</span>) <span class="sc">+</span></span>
|
||
<span id="cb16-42"><a href="#cb16-42" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span>
|
||
<span id="cb16-43"><a href="#cb16-43" aria-hidden="true" tabindex="-1"></a> <span class="at">title =</span> <span class="st">"Percentage Change of Diagnosed Diabetes 2006-2014"</span></span>
|
||
<span id="cb16-44"><a href="#cb16-44" aria-hidden="true" tabindex="-1"></a> ,<span class="at">fill =</span> <span class="st">"Percentage"</span></span>
|
||
<span id="cb16-45"><a href="#cb16-45" aria-hidden="true" tabindex="-1"></a> ,<span class="at">y =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb16-46"><a href="#cb16-46" aria-hidden="true" tabindex="-1"></a> ,<span class="at">x =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb16-47"><a href="#cb16-47" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span>
|
||
<span id="cb16-48"><a href="#cb16-48" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme</span>(</span>
|
||
<span id="cb16-49"><a href="#cb16-49" aria-hidden="true" tabindex="-1"></a> <span class="at">panel.background =</span> <span class="fu">element_rect</span>(<span class="at">fill =</span> <span class="st">"aliceblue"</span>)</span>
|
||
<span id="cb16-50"><a href="#cb16-50" aria-hidden="true" tabindex="-1"></a> ,<span class="at">panel.grid.major =</span> <span class="fu">element_line</span>(<span class="at">color =</span> <span class="st">"#D4D4D4"</span>, <span class="at">linetype =</span> <span class="st">"dashed"</span>, </span>
|
||
<span id="cb16-51"><a href="#cb16-51" aria-hidden="true" tabindex="-1"></a> <span class="at">size =</span> <span class="fl">0.5</span>)</span>
|
||
<span id="cb16-52"><a href="#cb16-52" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb16-53"><a href="#cb16-53" aria-hidden="true" tabindex="-1"></a></span>
|
||
<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>
|
||
</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>
|
||
<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>
|
||
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(</span>
|
||
<span id="cb17-4"><a href="#cb17-4" aria-hidden="true" tabindex="-1"></a> <span class="at">rural =</span> <span class="fu">factor</span>(rural</span>
|
||
<span id="cb17-5"><a href="#cb17-5" aria-hidden="true" tabindex="-1"></a> ,<span class="at">levels =</span> <span class="fu">c</span>(<span class="cn">TRUE</span>,<span class="cn">FALSE</span>)</span>
|
||
<span id="cb17-6"><a href="#cb17-6" aria-hidden="true" tabindex="-1"></a> ,<span class="at">labels =</span> <span class="fu">c</span>(<span class="st">"Rural"</span>, <span class="st">"Urban"</span>)</span>
|
||
<span id="cb17-7"><a href="#cb17-7" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb17-8"><a href="#cb17-8" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb17-9"><a href="#cb17-9" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb17-10"><a href="#cb17-10" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb17-11"><a href="#cb17-11" aria-hidden="true" tabindex="-1"></a>mean_d4 <span class="ot"><-</span> d4 <span class="sc">%>%</span> </span>
|
||
<span id="cb17-12"><a href="#cb17-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">group_by</span>(rural) <span class="sc">%>%</span> </span>
|
||
<span id="cb17-13"><a href="#cb17-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">summarise</span>(<span class="at">.groups =</span> <span class="st">"keep"</span></span>
|
||
<span id="cb17-14"><a href="#cb17-14" aria-hidden="true" tabindex="-1"></a> ,<span class="at">pct_c =</span> <span class="fu">mean</span>(pct_c)</span>
|
||
<span id="cb17-15"><a href="#cb17-15" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<span id="cb17-16"><a href="#cb17-16" aria-hidden="true" tabindex="-1"></a></span>
|
||
<span id="cb17-17"><a href="#cb17-17" aria-hidden="true" tabindex="-1"></a>g51 <span class="ot"><-</span> d4 <span class="sc">%>%</span> </span>
|
||
<span id="cb17-18"><a href="#cb17-18" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x =</span> pct_c, <span class="at">fill =</span> rural, <span class="at">y =</span> ..density.., <span class="at">color =</span> rural)) <span class="sc">+</span></span>
|
||
<span id="cb17-19"><a href="#cb17-19" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_histogram</span>(<span class="at">binwidth =</span> <span class="dv">5</span>, <span class="at">position =</span> <span class="st">"identity"</span>, <span class="at">alpha =</span> <span class="fl">0.3</span>) <span class="sc">+</span></span>
|
||
<span id="cb17-20"><a href="#cb17-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_density</span>(<span class="at">alpha =</span> <span class="fl">0.5</span>) <span class="sc">+</span></span>
|
||
<span id="cb17-21"><a href="#cb17-21" aria-hidden="true" tabindex="-1"></a> <span class="fu">facet_wrap</span>(<span class="sc">~</span>rural, <span class="at">ncol =</span> <span class="dv">1</span>) <span class="sc">+</span></span>
|
||
<span id="cb17-22"><a href="#cb17-22" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_vline</span>(<span class="fu">aes</span>(<span class="at">xintercept =</span> pct_c), <span class="at">data =</span> mean_d4) <span class="sc">+</span></span>
|
||
<span id="cb17-23"><a href="#cb17-23" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_text</span>(<span class="fu">aes</span>(<span class="at">x =</span> pct_c, <span class="at">y =</span> <span class="fl">0.038</span>, <span class="at">label =</span> <span class="fu">round</span>(pct_c, <span class="dv">2</span>))</span>
|
||
<span id="cb17-24"><a href="#cb17-24" aria-hidden="true" tabindex="-1"></a> ,<span class="at">data =</span> mean_d4</span>
|
||
<span id="cb17-25"><a href="#cb17-25" aria-hidden="true" tabindex="-1"></a> ,<span class="at">hjust =</span> <span class="sc">-</span><span class="fl">0.15</span></span>
|
||
<span id="cb17-26"><a href="#cb17-26" aria-hidden="true" tabindex="-1"></a> ,<span class="at">size =</span> <span class="dv">5</span></span>
|
||
<span id="cb17-27"><a href="#cb17-27" aria-hidden="true" tabindex="-1"></a> ,<span class="at">color =</span> <span class="st">"#000000"</span>) <span class="sc">+</span></span>
|
||
<span id="cb17-28"><a href="#cb17-28" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_vline</span>(<span class="at">xintercept =</span> <span class="dv">0</span>, <span class="at">linetype =</span> <span class="st">"dashed"</span>, <span class="at">color =</span> <span class="st">"#696969"</span>) <span class="sc">+</span></span>
|
||
<span id="cb17-29"><a href="#cb17-29" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_color_brewer</span>(<span class="at">palette =</span> <span class="st">"Dark2"</span>, <span class="at">guide =</span> <span class="cn">NULL</span>) <span class="sc">+</span></span>
|
||
<span id="cb17-30"><a href="#cb17-30" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_fill_brewer</span>(<span class="at">palette =</span> <span class="st">"Dark2"</span>, <span class="at">guide =</span> <span class="cn">NULL</span>) <span class="sc">+</span></span>
|
||
<span id="cb17-31"><a href="#cb17-31" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span>
|
||
<span id="cb17-32"><a href="#cb17-32" aria-hidden="true" tabindex="-1"></a> <span class="at">x =</span> <span class="st">"Percentage Change"</span></span>
|
||
<span id="cb17-33"><a href="#cb17-33" aria-hidden="true" tabindex="-1"></a> ,<span class="at">y =</span> <span class="st">"Density"</span></span>
|
||
<span id="cb17-34"><a href="#cb17-34" aria-hidden="true" tabindex="-1"></a> ,<span class="at">fill =</span> <span class="cn">NULL</span></span>
|
||
<span id="cb17-35"><a href="#cb17-35" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
<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>
|
||
</div>
|
||
</section>
|
||
<section id="conclusion-and-next-steps" class="level1">
|
||
<h1>Conclusion and Next Steps</h1>
|
||
<p>The original hypothesis of this report was that rural counties were growing at a higher rate then there urban counterparts. Through out this post it has been shown that this hypothesis is incorrect, just being a rural county does not indicate diabetes growth, in fact the growth rate throughout North Carolina has been consistent. Further posts will explore other reasons for these trends, as the current post merely explores the trends and differences using data visualizations, a more rigorous and formal evaluation of these comparison is in order.</p>
|
||
</section>
|
||
<section id="session-information" class="level1">
|
||
<h1>Session information</h1>
|
||
<p>===========================================================================</p>
|
||
<p>For the sake of documentation and reproducibility, the current report was rendered in the following environment. Click the line below to expand.</p>
|
||
<details>
|
||
<summary>
|
||
Environment <span class="glyphicon glyphicon-plus-sign"></span>
|
||
</summary>
|
||
<div class="cell">
|
||
<details>
|
||
<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>
|
||
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a>} <span class="cf">else</span> {</span>
|
||
<span id="cb18-4"><a href="#cb18-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">sessionInfo</span>()</span>
|
||
<span id="cb18-5"><a href="#cb18-5" aria-hidden="true" tabindex="-1"></a>} </span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||
</details>
|
||
<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)
|
||
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)
|
||
|
||
─ 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)
|
||
|
||
[1] C:/Users/belangew/AppData/Local/R/win-library/4.2
|
||
[2] C:/Program Files/R/R-4.2.1/library
|
||
|
||
──────────────────────────────────────────────────────────────────────────────</code></pre>
|
||
</div>
|
||
</div>
|
||
</details>
|
||
</section>
|
||
<section id="references" class="level1">
|
||
|
||
|
||
|
||
|
||
</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="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>
|
||
<div id="ref-Barker2013" class="csl-entry" role="listitem">
|
||
Barker, L. E., Thompson, T. J., Kirtland, K. A., Boyle, J. P., Geiss, L. S., McCauley, M. M., & Albright, A. L. (2013). Bayesian small area estimates of diabetes incidence by united states county, 2009. <em>Journal of Data Science</em>, <em>11</em>(1), 269–280. <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4537395/">https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4537395/</a>
|
||
</div>
|
||
<div id="ref-CDCP2020" class="csl-entry" role="listitem">
|
||
Centers for Disease Control and Prevention. (2020). <em>National diabetes statistics report</em>. <span>US Department of Health and Human Services</span>. <a href="https://www.cdc.gov/diabetes/pdfs/data/statistics/national-diabetes-statistics-report.pdf">https://www.cdc.gov/diabetes/pdfs/data/statistics/national-diabetes-statistics-report.pdf</a>
|
||
</div>
|
||
<div id="ref-Rao2003" class="csl-entry" role="listitem">
|
||
JNK, R. (2003). <em>Small area estimation</em>. <a href="https://onlinelibrary.wiley.com/doi/pdf/10.1002/0471722189.fmatter">https://onlinelibrary.wiley.com/doi/pdf/10.1002/0471722189.fmatter</a>
|
||
</div>
|
||
<div id="ref-Klein2001" class="csl-entry" role="listitem">
|
||
Klein, R. J., & Schoenborn, C. A. (2001). Age adjustment using the 2000 projected u.s. population. <em>Healthy People 2000 Stat Notes</em>, <em>20</em>, 1–9.
|
||
</div>
|
||
<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,
|
||
author = {Belanger, Kyle},
|
||
title = {Diabetes in {Rural} {North} {Carolina} : {Exploring}
|
||
{Prevalence} {Trends}},
|
||
date = {2020-06-25},
|
||
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-belanger2020" class="csl-entry quarto-appendix-citeas" role="listitem">
|
||
Belanger, K. (2020, June 25). <em>Diabetes in Rural North Carolina :
|
||
Exploring Prevalence Trends</em>.
|
||
</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();
|
||
});
|
||
function tippyHover(el, contentFn) {
|
||
const config = {
|
||
allowHTML: true,
|
||
content: contentFn,
|
||
maxWidth: 500,
|
||
delay: 100,
|
||
arrow: false,
|
||
appendTo: function(el) {
|
||
return el.parentElement;
|
||
},
|
||
interactive: true,
|
||
interactiveBorder: 10,
|
||
theme: 'quarto',
|
||
placement: 'bottom-start'
|
||
};
|
||
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);
|
||
return note.innerHTML;
|
||
});
|
||
}
|
||
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";
|
||
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;
|
||
};
|
||
// 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> |