updated site
3
.gitignore
vendored
|
@ -49,6 +49,3 @@ po/*~
|
|||
rsconnect/
|
||||
|
||||
/.quarto/
|
||||
|
||||
# using this folder to move old blog posts over
|
||||
old_posts/
|
|
@ -1,9 +1,5 @@
|
|||
project:
|
||||
type: website
|
||||
render:
|
||||
- "*.qmd"
|
||||
- "*.rmd"
|
||||
- "!old_posts/" #using for the time being to store old blog post while converting
|
||||
|
||||
website:
|
||||
title: "Kyle Belanger"
|
||||
|
|
|
@ -156,7 +156,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
<!-- margin-sidebar -->
|
||||
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
|
||||
|
||||
<h5 class="quarto-listing-category-title">Categories</h5><div class="quarto-listing-category category-default"><div class="category" data-category="">All <span class="quarto-category-count">(8)</span></div><div class="category" data-category="Distill">Distill <span class="quarto-category-count">(1)</span></div><div class="category" data-category="TidyTuesday">TidyTuesday <span class="quarto-category-count">(1)</span></div></div></div>
|
||||
<h5 class="quarto-listing-category-title">Categories</h5><div class="quarto-listing-category category-default"><div class="category" data-category="">All <span class="quarto-category-count">(9)</span></div><div class="category" data-category="Distill">Distill <span class="quarto-category-count">(1)</span></div><div class="category" data-category="TidyTuesday">TidyTuesday <span class="quarto-category-count">(1)</span></div></div></div>
|
||||
<!-- main -->
|
||||
<main class="content quarto-banner-title-block column-page-left" id="quarto-document-content">
|
||||
|
||||
|
@ -204,7 +204,7 @@ Kyle Belanger
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="1" data-categories="Distill" data-listing-date-sort="1610427600000" data-listing-file-modified-sort="1697115793517" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="3">
|
||||
<div class="quarto-post image-right" data-index="1" data-categories="Distill" data-listing-date-sort="1610427600000" data-listing-file-modified-sort="1697116059113" data-listing-date-modified-sort="1697083200000" data-listing-reading-time-sort="3">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2021-01-12_blogdown-to-distill/creating-a-distill-blog.html"> <div class="listing-item-img-placeholder card-img-top" > </div> </a></p>
|
||||
</div>
|
||||
|
@ -267,7 +267,35 @@ Kyle Belanger
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="3" data-listing-date-sort="1592798400000" data-listing-file-modified-sort="1697115048321" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="3">
|
||||
<div class="quarto-post image-right" data-index="3" data-listing-date-sort="1593057600000" data-listing-file-modified-sort="1697120858345" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="8">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2020-06-25_diabetes-prevalence-in-nc/diabetes-in-rural-north-carolina-exploring-prevalence-trends.html"> <p class="card-img-top"><img src="posts\2020-06-25_diabetes-prevalence-in-nc\diabetes-in-rural-north-carolina-exploring-prevalence-trends_files\figure-html\o-g1-1.png" class="thumbnail-image card-img"/></p> </a></p>
|
||||
</div>
|
||||
<div class="body">
|
||||
<a href="./posts/2020-06-25_diabetes-prevalence-in-nc/diabetes-in-rural-north-carolina-exploring-prevalence-trends.html">
|
||||
<h3 class="no-anchor listing-title">
|
||||
Diabetes in Rural North Carolina : Exploring Prevalence Trends
|
||||
</h3>
|
||||
<div class="listing-subtitle">
|
||||
<p>This post introduces the exploration of the Diabetes epidemic in North Carolina</p>
|
||||
</div>
|
||||
<div class="listing-description">
|
||||
2022-15-03: Since this was…
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<a href="./posts/2020-06-25_diabetes-prevalence-in-nc/diabetes-in-rural-north-carolina-exploring-prevalence-trends.html">
|
||||
<div class="listing-date">
|
||||
Jun 25, 2020
|
||||
</div>
|
||||
<div class="listing-author">
|
||||
Kyle Belanger
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="4" data-listing-date-sort="1592798400000" data-listing-file-modified-sort="1697115048321" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="3">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2020-06-22_excel-data-multiple-headers/importing-excel-data-with-multiple-header-rows.html"> <p class="card-img-top"><img src="posts\2020-06-22_excel-data-multiple-headers\example_data_img1.png" alt="image of example data" class="thumbnail-image card-img"/></p> </a></p>
|
||||
</div>
|
||||
|
@ -295,7 +323,7 @@ Kyle Belanger
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="4" data-listing-date-sort="1581570000000" data-listing-file-modified-sort="1697056704620" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="11">
|
||||
<div class="quarto-post image-right" data-index="5" data-listing-date-sort="1581570000000" data-listing-file-modified-sort="1697056704620" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="11">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2020-02-13_basic-who-TB-data/basic-exploration-of-who-tuberculosis-data.html"> <p class="card-img-top"><img src="posts\2020-02-13_basic-who-TB-data\basic-exploration-of-who-tuberculosis-data_files\figure-html\unnamed-chunk-5-1.png" class="thumbnail-image card-img"/></p> </a></p>
|
||||
</div>
|
||||
|
@ -323,7 +351,7 @@ Kyle Belanger
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="5" data-listing-date-sort="1581310800000" data-listing-file-modified-sort="1697114568395" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="8">
|
||||
<div class="quarto-post image-right" data-index="6" data-listing-date-sort="1581310800000" data-listing-file-modified-sort="1697114568395" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="8">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2020-02-10_line-graphs-and-interactivity/line-graphs-and-interactivity.html"> <p class="card-img-top"><img src="posts\2020-02-10_line-graphs-and-interactivity\flu_surveillance.png" alt="Example Line Graph" class="thumbnail-image card-img"/></p> </a></p>
|
||||
</div>
|
||||
|
@ -351,7 +379,7 @@ Kyle Belanger
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="6" data-listing-date-sort="1580274000000" data-listing-file-modified-sort="1697114439706" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="3">
|
||||
<div class="quarto-post image-right" data-index="7" data-listing-date-sort="1580274000000" data-listing-file-modified-sort="1697114439706" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="3">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2020-01-29_facets-and-humility/facets-and-a-lesson-in-humility.html"> <p class="card-img-top"><img src="posts\2020-01-29_facets-and-humility\WHO_LIFE.png" class="thumbnail-image card-img"/></p> </a></p>
|
||||
</div>
|
||||
|
@ -379,7 +407,7 @@ Kyle Belanger
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quarto-post image-right" data-index="7" data-listing-date-sort="1579842000000" data-listing-file-modified-sort="1697052101192" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="2">
|
||||
<div class="quarto-post image-right" data-index="8" data-listing-date-sort="1579842000000" data-listing-file-modified-sort="1697052101192" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="2">
|
||||
<div class="thumbnail">
|
||||
<p><a href="./posts/2020-01-04_my-start-to-r/my-start-to-r.html"> <p class="card-img-top"><img src="posts\2020-01-04_my-start-to-r\my-start-to-r_files\figure-html\unnamed-chunk-5-1.png" class="thumbnail-image card-img"/></p> </a></p>
|
||||
</div>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
"/posts/2021-02-26_tidytuesday-hbcu-enrollment/tidytuesday-2021-week-6-hbcu-enrolment.html",
|
||||
"/posts/2021-01-12_blogdown-to-distill/creating-a-distill-blog.html",
|
||||
"/posts/2020-07-25_diabetes-data-collection-and-cleaning/diabetes-in-rural-north-carolina-data-collection-and-cleaning.html",
|
||||
"/posts/2020-06-25_diabetes-prevalence-in-nc/diabetes-in-rural-north-carolina-exploring-prevalence-trends.html",
|
||||
"/posts/2020-06-22_excel-data-multiple-headers/importing-excel-data-with-multiple-header-rows.html",
|
||||
"/posts/2020-02-13_basic-who-TB-data/basic-exploration-of-who-tuberculosis-data.html",
|
||||
"/posts/2020-02-10_line-graphs-and-interactivity/line-graphs-and-interactivity.html",
|
||||
|
|
|
@ -255,7 +255,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
|
||||
</section>
|
||||
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2020,
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents"><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 = {My {Start} to {R}},
|
||||
date = {2020-01-24},
|
||||
|
|
|
@ -332,8 +332,8 @@ $ fiscal_year <fct> 2013, 2013, 2013, 2013, 2
|
|||
<span id="cb8-19"><a href="#cb8-19" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb8-20"><a href="#cb8-20" aria-hidden="true" tabindex="-1"></a>g2</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<div class="plotly html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-eb971b11b9886c1f8351" style="width:100%;height:464px;"></div>
|
||||
<script type="application/json" data-for="htmlwidget-eb971b11b9886c1f8351">{"x":{"visdat":{"72a023bd4952":["function () ","plotlyVisDat"]},"cur_data":"72a023bd4952","attrs":{"72a023bd4952":{"x":{},"y":{},"mode":"lines","hoverinfo":"y","color":{},"colors":["#a6611a","#dfc27d","#80cdc1","#018571"],"alpha_stroke":1,"sizes":[10,100],"spans":[1,20],"type":"scatter"}},"layout":{"margin":{"b":40,"l":60,"t":25,"r":10},"xaxis":{"domain":[0,1],"automargin":true,"title":"","type":"category","categoryorder":"array","categoryarray":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"]},"yaxis":{"domain":[0,1],"automargin":true,"title":"% Tests (+) for Influenza"},"title":"Flu Viral Surveillance: % Respiratory Specimens Positive for Influenza","legend":{"x":100,"y":0.5},"hovermode":"closest","showlegend":true},"source":"A","config":{"modeBarButtonsToAdd":["hoverclosest","hovercompare"],"showSendToCloud":false},"data":[{"x":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],"y":[5,13,34,33,23,17,11,6,4,3,3,3],"mode":"lines","hoverinfo":["y","y","y","y","y","y","y","y","y","y","y","y"],"type":"scatter","name":"2013","marker":{"color":"rgba(166,97,26,1)","line":{"color":"rgba(166,97,26,1)"}},"textfont":{"color":"rgba(166,97,26,1)"},"error_y":{"color":"rgba(166,97,26,1)"},"error_x":{"color":"rgba(166,97,26,1)"},"line":{"color":"rgba(166,97,26,1)"},"xaxis":"x","yaxis":"y","frame":null},{"x":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],"y":[4,8,26,27,18,12,14,10,6,4,3,2],"mode":"lines","hoverinfo":["y","y","y","y","y","y","y","y","y","y","y","y"],"type":"scatter","name":"2014","marker":{"color":"rgba(223,194,125,1)","line":{"color":"rgba(223,194,125,1)"}},"textfont":{"color":"rgba(223,194,125,1)"},"error_y":{"color":"rgba(223,194,125,1)"},"error_x":{"color":"rgba(223,194,125,1)"},"line":{"color":"rgba(223,194,125,1)"},"xaxis":"x","yaxis":"y","frame":null},{"x":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],"y":[4,13,29,23,14,12,8,4,2,2,2,2],"mode":"lines","hoverinfo":["y","y","y","y","y","y","y","y","y","y","y","y"],"type":"scatter","name":"2015","marker":{"color":"rgba(128,205,193,1)","line":{"color":"rgba(128,205,193,1)"}},"textfont":{"color":"rgba(128,205,193,1)"},"error_y":{"color":"rgba(128,205,193,1)"},"error_x":{"color":"rgba(128,205,193,1)"},"line":{"color":"rgba(128,205,193,1)"},"xaxis":"x","yaxis":"y","frame":null},{"x":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],"y":[1,1,2,6,17,20,12,5,2,1,1,2],"mode":"lines","hoverinfo":["y","y","y","y","y","y","y","y","y","y","y","y"],"type":"scatter","name":"2016","marker":{"color":"rgba(1,133,113,1)","line":{"color":"rgba(1,133,113,1)"}},"textfont":{"color":"rgba(1,133,113,1)"},"error_y":{"color":"rgba(1,133,113,1)"},"error_x":{"color":"rgba(1,133,113,1)"},"line":{"color":"rgba(1,133,113,1)"},"xaxis":"x","yaxis":"y","frame":null}],"highlight":{"on":"plotly_click","persistent":false,"dynamic":false,"selectize":false,"opacityDim":0.2,"selected":{"opacity":1},"debounce":0},"shinyEvents":["plotly_hover","plotly_click","plotly_selected","plotly_relayout","plotly_brushed","plotly_brushing","plotly_clickannotation","plotly_doubleclick","plotly_deselect","plotly_afterplot","plotly_sunburstclick"],"base_url":"https://plot.ly"},"evals":[],"jsHooks":[]}</script>
|
||||
<div class="plotly html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-c6890387e2fdea7c330a" style="width:100%;height:464px;"></div>
|
||||
<script type="application/json" data-for="htmlwidget-c6890387e2fdea7c330a">{"x":{"visdat":{"4b1839396125":["function () ","plotlyVisDat"]},"cur_data":"4b1839396125","attrs":{"4b1839396125":{"x":{},"y":{},"mode":"lines","hoverinfo":"y","color":{},"colors":["#a6611a","#dfc27d","#80cdc1","#018571"],"alpha_stroke":1,"sizes":[10,100],"spans":[1,20],"type":"scatter"}},"layout":{"margin":{"b":40,"l":60,"t":25,"r":10},"xaxis":{"domain":[0,1],"automargin":true,"title":"","type":"category","categoryorder":"array","categoryarray":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"]},"yaxis":{"domain":[0,1],"automargin":true,"title":"% Tests (+) for Influenza"},"title":"Flu Viral Surveillance: % Respiratory Specimens Positive for Influenza","legend":{"x":100,"y":0.5},"hovermode":"closest","showlegend":true},"source":"A","config":{"modeBarButtonsToAdd":["hoverclosest","hovercompare"],"showSendToCloud":false},"data":[{"x":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],"y":[5,13,34,33,23,17,11,6,4,3,3,3],"mode":"lines","hoverinfo":["y","y","y","y","y","y","y","y","y","y","y","y"],"type":"scatter","name":"2013","marker":{"color":"rgba(166,97,26,1)","line":{"color":"rgba(166,97,26,1)"}},"textfont":{"color":"rgba(166,97,26,1)"},"error_y":{"color":"rgba(166,97,26,1)"},"error_x":{"color":"rgba(166,97,26,1)"},"line":{"color":"rgba(166,97,26,1)"},"xaxis":"x","yaxis":"y","frame":null},{"x":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],"y":[4,8,26,27,18,12,14,10,6,4,3,2],"mode":"lines","hoverinfo":["y","y","y","y","y","y","y","y","y","y","y","y"],"type":"scatter","name":"2014","marker":{"color":"rgba(223,194,125,1)","line":{"color":"rgba(223,194,125,1)"}},"textfont":{"color":"rgba(223,194,125,1)"},"error_y":{"color":"rgba(223,194,125,1)"},"error_x":{"color":"rgba(223,194,125,1)"},"line":{"color":"rgba(223,194,125,1)"},"xaxis":"x","yaxis":"y","frame":null},{"x":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],"y":[4,13,29,23,14,12,8,4,2,2,2,2],"mode":"lines","hoverinfo":["y","y","y","y","y","y","y","y","y","y","y","y"],"type":"scatter","name":"2015","marker":{"color":"rgba(128,205,193,1)","line":{"color":"rgba(128,205,193,1)"}},"textfont":{"color":"rgba(128,205,193,1)"},"error_y":{"color":"rgba(128,205,193,1)"},"error_x":{"color":"rgba(128,205,193,1)"},"line":{"color":"rgba(128,205,193,1)"},"xaxis":"x","yaxis":"y","frame":null},{"x":["Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"],"y":[1,1,2,6,17,20,12,5,2,1,1,2],"mode":"lines","hoverinfo":["y","y","y","y","y","y","y","y","y","y","y","y"],"type":"scatter","name":"2016","marker":{"color":"rgba(1,133,113,1)","line":{"color":"rgba(1,133,113,1)"}},"textfont":{"color":"rgba(1,133,113,1)"},"error_y":{"color":"rgba(1,133,113,1)"},"error_x":{"color":"rgba(1,133,113,1)"},"line":{"color":"rgba(1,133,113,1)"},"xaxis":"x","yaxis":"y","frame":null}],"highlight":{"on":"plotly_click","persistent":false,"dynamic":false,"selectize":false,"opacityDim":0.2,"selected":{"opacity":1},"debounce":0},"shinyEvents":["plotly_hover","plotly_click","plotly_selected","plotly_relayout","plotly_brushed","plotly_brushing","plotly_clickannotation","plotly_doubleclick","plotly_deselect","plotly_afterplot","plotly_sunburstclick"],"base_url":"https://plot.ly"},"evals":[],"jsHooks":[]}</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 149 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 88 KiB |
|
@ -166,6 +166,12 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="quarto-title-meta-heading">Modified</div>
|
||||
<div class="quarto-title-meta-contents">
|
||||
<p class="date-modified">October 12, 2023</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
<meta name="author" content="Harlow Malloc">
|
||||
<meta name="dcterms.date" content="2023-10-03">
|
||||
<meta name="author" content="Kyle Belanger">
|
||||
<meta name="dcterms.date" content="2022-07-28">
|
||||
|
||||
<title>Kyle Belanger - Post With Code</title>
|
||||
<title>Kyle Belanger - Making Maps in R</title>
|
||||
<style>
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
|
@ -66,7 +66,7 @@ ul.task-list li input[type="checkbox"] {
|
|||
<link rel="stylesheet" href="../../styles.css">
|
||||
</head>
|
||||
|
||||
<body class="nav-fixed fullcontent">
|
||||
<body class="floating nav-fixed">
|
||||
|
||||
<div id="quarto-search-results"></div>
|
||||
<header id="quarto-header" class="headroom fixed-top">
|
||||
|
@ -86,6 +86,10 @@ ul.task-list li input[type="checkbox"] {
|
|||
<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">
|
||||
|
@ -100,15 +104,11 @@ ul.task-list li input[type="checkbox"] {
|
|||
</nav>
|
||||
</header>
|
||||
<!-- content -->
|
||||
<header id="title-block-header" class="quarto-title-block default page-columns page-full">
|
||||
<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">Post With Code</h1>
|
||||
<div class="quarto-categories">
|
||||
<div class="quarto-category">news</div>
|
||||
<div class="quarto-category">code</div>
|
||||
<div class="quarto-category">analysis</div>
|
||||
</div>
|
||||
<h1 class="title">Making Maps in R</h1>
|
||||
<p class="subtitle lead"></p><p>A short description of the post.</p><p></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -118,14 +118,14 @@ ul.task-list li input[type="checkbox"] {
|
|||
<div>
|
||||
<div class="quarto-title-meta-heading">Author</div>
|
||||
<div class="quarto-title-meta-contents">
|
||||
<p>Harlow Malloc </p>
|
||||
<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">October 3, 2023</p>
|
||||
<p class="date">July 28, 2022</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -135,19 +135,33 @@ ul.task-list li input[type="checkbox"] {
|
|||
|
||||
</header><div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
|
||||
<!-- sidebar -->
|
||||
<!-- margin-sidebar -->
|
||||
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
|
||||
|
||||
</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" id="quarto-document-content">
|
||||
|
||||
|
||||
|
||||
|
||||
<p>This is a post with executable code.</p>
|
||||
<p>Distill is a publication format for scientific and technical writing, native to the web.</p>
|
||||
<p>Learn more about using Distill at <a href="https://rstudio.github.io/distill" class="uri">https://rstudio.github.io/distill</a>.</p>
|
||||
|
||||
|
||||
|
||||
</main> <!-- /main -->
|
||||
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div id="quarto-reuse" class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</a></div></div></section><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{belanger2022,
|
||||
author = {Belanger, Kyle},
|
||||
title = {Making {Maps} in {R}},
|
||||
date = {2022-07-28},
|
||||
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-belanger2022" class="csl-entry quarto-appendix-citeas" role="listitem">
|
||||
Belanger, Kyle. 2022. <span>“Making Maps in R.”</span> July 28, 2022.
|
||||
</div></div></section></div></main> <!-- /main -->
|
||||
<script id="quarto-html-after-body" type="application/javascript">
|
||||
window.document.addEventListener("DOMContentLoaded", function (event) {
|
||||
const toggleBodyColorMode = (bsSheetEl) => {
|
Before Width: | Height: | Size: 41 KiB |
|
@ -1,388 +0,0 @@
|
|||
<!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="Tristan O’Malley">
|
||||
<meta name="dcterms.date" content="2023-09-30">
|
||||
|
||||
<title>Kyle Belanger - Welcome To My Blog</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;
|
||||
}
|
||||
</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="nav-fixed fullcontent">
|
||||
|
||||
<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 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 page-columns page-full">
|
||||
<div class="quarto-title-banner page-columns page-full">
|
||||
<div class="quarto-title column-body">
|
||||
<h1 class="title">Welcome To My Blog</h1>
|
||||
<div class="quarto-categories">
|
||||
<div class="quarto-category">news</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="quarto-title-meta">
|
||||
|
||||
<div>
|
||||
<div class="quarto-title-meta-heading">Author</div>
|
||||
<div class="quarto-title-meta-contents">
|
||||
<p>Tristan O’Malley </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="quarto-title-meta-heading">Published</div>
|
||||
<div class="quarto-title-meta-contents">
|
||||
<p class="date">September 30, 2023</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</header><div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
|
||||
<!-- sidebar -->
|
||||
<!-- margin-sidebar -->
|
||||
|
||||
<!-- main -->
|
||||
<main class="content quarto-banner-title-block" id="quarto-document-content">
|
||||
|
||||
|
||||
|
||||
|
||||
<p>This is the first post in a Quarto blog. Welcome!</p>
|
||||
<p><img src="thumbnail.jpg" class="img-fluid"></p>
|
||||
<p>Since this post doesn’t specify an explicit <code>image</code>, the first image in the post will be used in the listing page of posts.</p>
|
||||
|
||||
|
||||
|
||||
</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>
|
Before Width: | Height: | Size: 39 KiB |
1718
posts/2020-06-25_diabetes-prevalence-in-nc/apa.csl
Normal file
57
posts/2020-06-25_diabetes-prevalence-in-nc/basic_bib.bib
Normal file
|
@ -0,0 +1,57 @@
|
|||
% Encoding: UTF-8
|
||||
|
||||
@Electronic{CDCP2020,
|
||||
author = {{Centers for Disease Control and Prevention}},
|
||||
organization = {{US Department of Health and Human Services}},
|
||||
title = {National Diabetes Statistics Report},
|
||||
url = {https://www.cdc.gov/diabetes/pdfs/data/statistics/national-diabetes-statistics-report.pdf},
|
||||
year = {2020},
|
||||
}
|
||||
|
||||
@Article{Pierannunzi2012,
|
||||
author = {Carol Pierannunzi and Machell Town and William Garvin and Frederick E. Shaw and Lina Balluz},
|
||||
journal = {Morbidity and Mortality Weekly Report},
|
||||
title = {Methodologic Changes in the Behavioral Risk Factor Surveillance System in 2011 and Potential Effects on Prevalence Estimates},
|
||||
year = {2012},
|
||||
number = {22},
|
||||
pages = {410 - 413},
|
||||
volume = {61},
|
||||
url = {https://www.cdc.gov/mmwr/pdf/wk/mm6122.pdf},
|
||||
}
|
||||
|
||||
@Article{Rao2003,
|
||||
author = {Rao JNK},
|
||||
title = {Small Area Estimation},
|
||||
year = {2003},
|
||||
url = {https://onlinelibrary.wiley.com/doi/pdf/10.1002/0471722189.fmatter},
|
||||
}
|
||||
|
||||
@Article{Barker2013,
|
||||
author = {Lawrence E. Barker and Theodore J. Thompson and Karen A Kirtland and James P Boyle and Linda S Geiss and Mary M McCauley and Ann L. Albright},
|
||||
journal = {Journal of Data Science},
|
||||
title = {Bayesian Small Area Estimates of Diabetes Incidence by United States County, 2009},
|
||||
year = {2013},
|
||||
month = apr,
|
||||
number = {1},
|
||||
pages = {269-280},
|
||||
volume = {11},
|
||||
url = {https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4537395/},
|
||||
}
|
||||
|
||||
@Article{Klein2001,
|
||||
author = {R J Klein and C A Schoenborn},
|
||||
journal = {Healthy People 2000 Stat Notes},
|
||||
title = {Age adjustment using the 2000 projected U.S. population},
|
||||
year = {2001},
|
||||
pages = {1-9},
|
||||
volume = {20},
|
||||
}
|
||||
|
||||
@Electronic{ADA2015,
|
||||
author = {{American Diabetes Asssociation}},
|
||||
title = {The Burden of Diabetes in North Carolina},
|
||||
url = {http://main.diabetes.org/dorg/PDFs/Advocacy/burden-of-diabetes/north-carolina.pdf},
|
||||
year = {2015},
|
||||
}
|
||||
|
||||
@Comment{jabref-meta: databaseType:bibtex;}
|
541
posts/2020-06-25_diabetes-prevalence-in-nc/diabetes-1.R
Normal file
|
@ -0,0 +1,541 @@
|
|||
#These first few lines run only when the file is run in RStudio, !!NOT when an Rmd/Rnw file calls it!!
|
||||
rm(list=ls(all=TRUE)) #Clear the variables from previous runs.
|
||||
cat("\f") # clear console
|
||||
|
||||
# ---- load-packages --------------------------------------------------
|
||||
# Attach these packages so their functions don't need to be qualified: http://r-pkgs.had.co.nz/namespace.html#search-path
|
||||
library(magrittr) # enables piping : %>%
|
||||
library(dplyr) # data wrangling
|
||||
library(ggplot2) # graphs
|
||||
library(tidyr) # data tidying
|
||||
library(maps)
|
||||
library(mapdata)
|
||||
library(sf)
|
||||
library(readr)
|
||||
|
||||
|
||||
# ---- load-sources ---------------------------------------------------
|
||||
|
||||
|
||||
|
||||
# ---- declare-globals ----------------------------------------------------
|
||||
|
||||
#set ggplot theme
|
||||
ggplot2::theme_set(theme_bw())
|
||||
|
||||
# ---- load-data ------------------------------------------------------
|
||||
|
||||
# load the data, and have all column names in lowercase
|
||||
|
||||
nc_diabetes_data_raw <- read_csv("https://raw.githubusercontent.com/mmmmtoasty19/nc-diabetes-epidemic-2020/62bdaa6971fbdff09214de7c013d40122abbe40d/data-public/derived/nc-diabetes-data.csv") %>%
|
||||
rename_all(tolower)
|
||||
|
||||
us_diabetes_data_raw <- read_csv("https://github.com/mmmmtoasty19/nc-diabetes-epidemic-2020/raw/62bdaa6971fbdff09214de7c013d40122abbe40d/data-public/raw/us_diabetes_totals.csv"
|
||||
,skip = 2)
|
||||
|
||||
rural_counties <- read_csv("https://github.com/mmmmtoasty19/nc-diabetes-epidemic-2020/raw/b29bfd93b20b73a7000d349cb3b55fd0822afe76/data-public/metadata/rural-counties.csv")
|
||||
|
||||
county_centers_raw <- read_csv("https://github.com/mmmmtoasty19/nc-diabetes-epidemic-2020/raw/b29bfd93b20b73a7000d349cb3b55fd0822afe76/data-public/raw/nc_county_centers.csv", col_names = c("county", "lat","long"))
|
||||
|
||||
diabetes_atlas_data_raw <- read_csv("https://raw.githubusercontent.com/mmmmtoasty19/nc-diabetes-epidemic-2020/b29bfd93b20b73a7000d349cb3b55fd0822afe76/data-public/raw/DiabetesAtlasData.csv"
|
||||
,col_types = cols(LowerLimit = col_skip(),
|
||||
UpperLimit = col_skip(),
|
||||
Percentage = col_double()), skip = 2)
|
||||
|
||||
|
||||
|
||||
|
||||
# ---- load-map-data ----------------------------------------------------------
|
||||
|
||||
# load in both US State Map and NC County Map
|
||||
|
||||
nc_counties_map_raw <- st_as_sf(map("county",region = "north carolina", plot = FALSE,fill = TRUE)) %>%
|
||||
mutate_at("ID", ~stringr::str_remove(.,"north carolina,"))
|
||||
|
||||
state_map_raw <- st_as_sf(map("state",plot = FALSE,fill = TRUE ))
|
||||
|
||||
nc_cities <- st_as_sf(read_csv("https://github.com/mmmmtoasty19/nc-diabetes-epidemic-2020/raw/b29bfd93b20b73a7000d349cb3b55fd0822afe76/data-public/metadata/nc_cities.csv"),
|
||||
coords = c("long", "lat")
|
||||
,remove = FALSE
|
||||
,agr = "constant"
|
||||
,crs = 4326)
|
||||
|
||||
|
||||
|
||||
|
||||
# ---- tweak-data --------------------------------------------------------------
|
||||
|
||||
county_centers <- county_centers_raw %>%
|
||||
mutate_all(~stringr::str_replace_all(.,
|
||||
c("\\°" = ""
|
||||
,"\\+" = ""
|
||||
,"\\–" = "-"
|
||||
)
|
||||
)
|
||||
) %>%
|
||||
mutate(across(c("lat","long"), ~iconv(.,from = 'UTF-8', to = 'ASCII//TRANSLIT'))
|
||||
,across(c("lat","long"),~stringr::str_remove_all(.,"\\?"))) %>%
|
||||
mutate_at(c("lat","long"),as.numeric) %>%
|
||||
mutate(across("long", ~(. * -1))) %>%
|
||||
mutate_at("county", tolower)
|
||||
|
||||
|
||||
|
||||
|
||||
us_diabetes_data <- us_diabetes_data_raw %>%
|
||||
filter(Year >= 2000) %>%
|
||||
select( "Year","Total - Percentage") %>%
|
||||
rename(year = Year , us_pct = `Total - Percentage`)
|
||||
|
||||
diabetes_atlas_data <- diabetes_atlas_data_raw %>%
|
||||
mutate_at("State", tolower) %>%
|
||||
filter(Year >= 2000)
|
||||
|
||||
state_map_abb <- state_map_raw %>%
|
||||
left_join(read_csv("https://github.com/mmmmtoasty19/nc-diabetes-epidemic-2020/raw/b29bfd93b20b73a7000d349cb3b55fd0822afe76/data-public/metadata/state-abb.csv") %>%
|
||||
mutate_at("state", tolower)
|
||||
,by = c("ID" = "state") )
|
||||
|
||||
|
||||
|
||||
# ---- merge-data ---------------------------------------------------------
|
||||
|
||||
#join US totals to NC data
|
||||
|
||||
nc_diabetes_data <- nc_diabetes_data_raw %>%
|
||||
mutate_at("county", ~stringr::str_replace_all(.,"Mcdowell","McDowell")) %>%
|
||||
mutate(
|
||||
rural = county %in% rural_counties$rural_counties
|
||||
) %>%
|
||||
mutate_at("county",tolower) %>%
|
||||
left_join(us_diabetes_data)
|
||||
|
||||
|
||||
nc_counties_map <- nc_counties_map_raw %>%
|
||||
left_join(nc_diabetes_data, by = c("ID" = "county")) %>%
|
||||
left_join(county_centers, by = c("ID" = "county")) %>%
|
||||
rename(
|
||||
center_long = long
|
||||
,center_lat = lat)
|
||||
|
||||
state_map <- state_map_abb %>%
|
||||
left_join(diabetes_atlas_data, by = c("ID" = "State")) %>%
|
||||
rename_all(tolower)
|
||||
|
||||
|
||||
|
||||
# ---- o-g1 ------------------------------------------------------------------
|
||||
|
||||
|
||||
us_diabetes_data <- us_diabetes_data %>%
|
||||
mutate(
|
||||
change = lead(us_pct) - us_pct
|
||||
,change = if_else(change > 0, TRUE, FALSE)
|
||||
) %>%
|
||||
mutate_at("change", ~stringr::str_replace_na(.,"NA"))
|
||||
|
||||
|
||||
|
||||
o_g1 <- us_diabetes_data %>%
|
||||
ggplot(aes(x = year, y = us_pct)) +
|
||||
geom_line(color= "#D95F02") +
|
||||
# geom_line(aes(color = change, group = 1)) +
|
||||
geom_point(shape = 21, size = 3,color= "#D95F02") +
|
||||
# geom_point(aes(color = change),shape = 21, size = 3) +
|
||||
scale_color_manual(values = c(
|
||||
"TRUE" = "#D95F02"
|
||||
,"FALSE" = "#7570B3"
|
||||
), guide = FALSE) +
|
||||
labs(
|
||||
title = "Percentage of Diagnosed Diabetes in Adults (18+), National Level"
|
||||
,x = NULL
|
||||
,y = NULL
|
||||
,caption = "Note: Data from the CDC's National Health Interview Survey (NHIS)"
|
||||
)
|
||||
|
||||
o_g1
|
||||
|
||||
|
||||
|
||||
# ---- s-g1 -----------------------------------------------------------------
|
||||
|
||||
|
||||
s_g1 <- state_map %>%
|
||||
st_drop_geometry() %>%
|
||||
ggplot(aes(x = year, y = percentage, color = region)) +
|
||||
geom_line(aes(group = id ),alpha = 0.3,na.rm = TRUE) +
|
||||
geom_smooth(method = "lm", se = FALSE) +
|
||||
ggpmisc::stat_poly_eq(formula = y ~ + x ,
|
||||
aes(label = paste(..eq.label.., ..rr.label.., sep = "~~~")),
|
||||
parse = TRUE) +
|
||||
geom_vline(xintercept = 2011, linetype = "dashed", color = "gray") +
|
||||
scale_color_brewer(palette = "Dark2"
|
||||
,direction = -1
|
||||
,labels = snakecase::to_title_case
|
||||
) +
|
||||
labs(
|
||||
title = "Percentage of Diagnosed Diabetes in Adults (18+) \nby State and Region"
|
||||
,x = NULL
|
||||
,y = NULL
|
||||
,color = "Region"
|
||||
,caption = "Regions from US Census Bureau"
|
||||
)
|
||||
|
||||
s_g1
|
||||
|
||||
|
||||
|
||||
|
||||
# ---- s-g2 ---------------------------------------------------------------
|
||||
|
||||
s_g2 <- state_map %>%
|
||||
st_drop_geometry() %>%
|
||||
filter(region == "south") %>%
|
||||
mutate_at("id", ~snakecase::to_title_case(.)) %>%
|
||||
ggplot(aes(x = year, y = percentage)) +
|
||||
geom_line(aes(group = id ),na.rm = TRUE, color= "#D95F02") +
|
||||
gghighlight::gghighlight(id == "North Carolina", label_params = list(vjust = 3)) +
|
||||
scale_y_continuous(breaks = seq(5,13,2)) +
|
||||
scale_x_continuous(minor_breaks = seq(2000,2016,1)) +
|
||||
labs(
|
||||
title = "Percentage of Diagnosed Diabetes in Adults (18+) \nSouth Region"
|
||||
,x = NULL
|
||||
,y = NULL
|
||||
,caption = "Regions from US Census Bureau"
|
||||
) +
|
||||
theme()
|
||||
|
||||
s_g2
|
||||
|
||||
|
||||
|
||||
# ---- nc-g1 ----------------------------------------------------------------------
|
||||
|
||||
d1 <- nc_diabetes_data %>%
|
||||
group_by(year) %>%
|
||||
summarise(
|
||||
pct = mean(percentage)
|
||||
,us_pct = mean(us_pct)
|
||||
) %>%
|
||||
pivot_longer(
|
||||
cols = c("pct", "us_pct")
|
||||
,names_to = "metric"
|
||||
,values_to = "values"
|
||||
) %>%
|
||||
mutate(
|
||||
metric = factor(metric
|
||||
,levels = c("pct","us_pct")
|
||||
,labels = c("NC", "National"))
|
||||
)
|
||||
|
||||
nc_g1 <- d1 %>%
|
||||
ggplot(aes(x = year, y = values, color = metric)) +
|
||||
geom_line() +
|
||||
geom_point(shape = 21, size = 3) +
|
||||
geom_vline(xintercept = 2011, linetype = "dashed", color = "gray") +
|
||||
scale_y_continuous(labels = function(x) paste0(x, "%")) +
|
||||
scale_color_brewer(palette = "Dark2") +
|
||||
labs(
|
||||
x = NULL
|
||||
,y = NULL
|
||||
,color = NULL
|
||||
,title = "Percent of Adults (20+) with Diagnosed Diabetes"
|
||||
)
|
||||
|
||||
nc_g1
|
||||
|
||||
# ---- nc-data-aberration ---------------------------------------------------
|
||||
|
||||
nc_g1a <- nc_diabetes_data %>%
|
||||
ggplot(aes(x = year, y = percentage)) +
|
||||
geom_line(aes(group = county),alpha = 0.4) +
|
||||
labs(
|
||||
x = NULL
|
||||
,y = NULL
|
||||
,color = NULL
|
||||
)
|
||||
|
||||
nc_g1a
|
||||
|
||||
|
||||
# ---- nc-g2 -----------------------------------------------------------------
|
||||
|
||||
d2 <- nc_diabetes_data %>%
|
||||
select(-us_pct) %>%
|
||||
mutate(
|
||||
pct_rural = if_else(rural == TRUE, percentage, FALSE)
|
||||
,pct_urban = if_else(rural == FALSE, percentage, FALSE)
|
||||
) %>%
|
||||
select(-countyfips,-percentage) %>%
|
||||
group_by(year) %>%
|
||||
summarise(
|
||||
pct_rural = mean(pct_rural,na.rm = TRUE)
|
||||
,pct_urban = mean(pct_urban,na.rm = TRUE)
|
||||
) %>% left_join(us_diabetes_data) %>%
|
||||
pivot_longer(
|
||||
cols = c("us_pct", "pct_rural","pct_urban")
|
||||
,names_to = "metric"
|
||||
,values_to = "value"
|
||||
,values_drop_na = TRUE
|
||||
) %>%
|
||||
mutate(
|
||||
metric = factor(metric,
|
||||
levels = c("pct_rural","pct_urban","us_pct")
|
||||
,labels = c("Rural","Urban","US")
|
||||
)
|
||||
)
|
||||
|
||||
nc_g2 <- d2 %>% ggplot(aes(x = year, y = value, color = metric)) +
|
||||
geom_line() +
|
||||
geom_point(shape = 21, size = 3) +
|
||||
geom_vline(xintercept = 2011, linetype = "dashed", color = "gray") +
|
||||
scale_y_continuous(labels = function(x) paste0(x, "%")) +
|
||||
scale_color_brewer(palette = "Dark2") +
|
||||
labs(
|
||||
x = NULL
|
||||
,y = NULL
|
||||
,color = NULL
|
||||
,title = "Percent of Adults (20+) with Diagnosed Diabetes \nDisplaying Rural vs Urban"
|
||||
)
|
||||
|
||||
nc_g2
|
||||
|
||||
# ---- spaghetti-plot ----------------------------------------------------
|
||||
|
||||
g50 <- nc_diabetes_data %>%
|
||||
filter(year < 2015) %>%
|
||||
mutate(
|
||||
rural = factor(rural
|
||||
,levels = c(TRUE,FALSE)
|
||||
,labels = c("Rural", "Urban")
|
||||
)
|
||||
) %>%
|
||||
ggplot(aes(x = year, y = percentage, color = rural)) +
|
||||
geom_line(aes(group = county),alpha = 0.3) +
|
||||
geom_smooth(aes(group = rural), method = "loess", se= FALSE, size = 1.1) +
|
||||
scale_color_brewer(palette = "Dark2") +
|
||||
labs(
|
||||
title = "Percent of Adults (20+) with Diagnosed Diabetes \nAll North Carolina Counties"
|
||||
,x = NULL
|
||||
,y = NULL
|
||||
,color = NULL
|
||||
)
|
||||
|
||||
g50
|
||||
|
||||
|
||||
# ---- c-g1 --------------------------------------------------------------
|
||||
|
||||
|
||||
nc_counties_map_binned <- nc_counties_map %>%
|
||||
filter(year < 2015) %>%
|
||||
mutate(
|
||||
bin = dlookr::binning(.$percentage, nbins = 6 ,type = "equal")
|
||||
,bin = forcats::fct_recode(bin
|
||||
,"6.5 - 7.9" = "[6.5,7.97]"
|
||||
,"8.0 - 9.4" = "(7.97,9.43]"
|
||||
,"9.5 - 10.9" = "(9.43,10.9]"
|
||||
,"11.0 - 12.4" = "(10.9,12.4]"
|
||||
,"12.5 - 13.8" = "(12.4,13.8]"
|
||||
,"13.9 - 15.3" = "(13.8,15.3]"
|
||||
)
|
||||
)
|
||||
|
||||
c_g1 <- nc_counties_map_binned %>%
|
||||
filter(year %in% c(2006,2014)) %>%
|
||||
ggplot() +
|
||||
geom_sf() + #blank geom_sf keeps gridlines from overlapping map
|
||||
geom_sf(aes(fill = bin,color = rural)) +
|
||||
geom_sf(data = nc_cities) +
|
||||
ggrepel::geom_text_repel(data = nc_cities,
|
||||
aes(x = long, y = lat, label = city)
|
||||
,nudge_y = c(-1,1,1,-1,1)
|
||||
,nudge_x = c(0,0,0,-1,0)
|
||||
) +
|
||||
geom_text(data = . %>% filter(rural == TRUE)
|
||||
,aes(x = center_long, y = center_lat)
|
||||
,label = "R"
|
||||
,color = "#696969"
|
||||
) +
|
||||
coord_sf(xlim = c(-84.5,-75.5), ylim = c(33.75,37)) +
|
||||
facet_wrap(~year) +
|
||||
scale_fill_viridis_d(alpha = 0.6, direction = -1) +
|
||||
scale_color_manual(
|
||||
values = c(
|
||||
"FALSE" = "gray"
|
||||
,"TRUE" = "black"
|
||||
),guide = 'none') +
|
||||
labs(
|
||||
title = "Estimated Diabetes in Adults (20+) by County"
|
||||
,fill = "Percentage"
|
||||
,y = NULL
|
||||
,x = NULL
|
||||
) +
|
||||
theme(
|
||||
panel.background = element_rect(fill = "aliceblue")
|
||||
,panel.grid.major = element_line(color = "#D4D4D4", linetype = "dashed",
|
||||
size = 0.5)
|
||||
,legend.position = "bottom"
|
||||
,plot.title = element_text(hjust = 0.5)
|
||||
)
|
||||
|
||||
c_g1
|
||||
|
||||
# ---- county-distribution-histogram ------------------------------------
|
||||
|
||||
# Not USED
|
||||
c_g1a <- nc_counties_map_binned %>%
|
||||
mutate(
|
||||
rural = factor(rural
|
||||
,levels = c(TRUE,FALSE)
|
||||
,labels = c("Rural", "Urban")
|
||||
)
|
||||
) %>%
|
||||
filter(year %in% c(2006,2014)) %>%
|
||||
ggplot(aes(x = bin, fill = rural)) +
|
||||
geom_bar(stat = "count"
|
||||
,position = "dodge"
|
||||
) +
|
||||
geom_text(aes(label=..count..)
|
||||
,position = position_dodge(width = 1)
|
||||
,stat = "count"
|
||||
,vjust = -0.1
|
||||
,size = 5) +
|
||||
facet_wrap(~year) +
|
||||
scale_fill_brewer(palette = "Dark2") +
|
||||
labs(
|
||||
fill = NULL
|
||||
,x = NULL
|
||||
,y = NULL
|
||||
)
|
||||
|
||||
c_g1a
|
||||
|
||||
# ---- county-boxplot ----
|
||||
|
||||
c_g1c <- nc_counties_map %>%
|
||||
mutate(
|
||||
rural = factor(rural
|
||||
,levels = c(TRUE,FALSE)
|
||||
,labels = c("Rural", "Urban")
|
||||
)) %>%
|
||||
filter(year < 2015) %>%
|
||||
ggplot(aes(x = year, y = percentage, group = interaction(year,rural), fill = rural)) +
|
||||
geom_boxplot(alpha = 0.5) +
|
||||
scale_fill_brewer(palette = "Dark2") +
|
||||
scale_x_continuous(breaks = seq(2004,2014,2)) +
|
||||
labs(
|
||||
x = NULL
|
||||
,y = NULL
|
||||
,fill = NULL
|
||||
,title = "Distribution of Estimated Cases by County 2006 - 2014"
|
||||
)
|
||||
|
||||
c_g1c
|
||||
|
||||
|
||||
|
||||
|
||||
# ---- c-g4 ---------------------------------------------------------------
|
||||
d3 <- nc_counties_map %>%
|
||||
st_drop_geometry() %>%
|
||||
filter(year %in% c(2006,2014)) %>%
|
||||
select(-countyfips,-us_pct) %>%
|
||||
pivot_wider(names_from = "year"
|
||||
,values_from = "percentage") %>%
|
||||
mutate(
|
||||
pct_p = `2014` - `2006`
|
||||
,pct_c = ((`2014` - `2006`)/`2006`) * 100
|
||||
) %>%
|
||||
left_join(nc_counties_map_raw) %>%
|
||||
st_as_sf()
|
||||
|
||||
|
||||
c_g4 <- d3 %>%
|
||||
ggplot() +
|
||||
geom_sf() + #blank geom_sf keeps gridlines from overlapping map
|
||||
geom_sf(aes(fill = pct_c ,color = rural)) +
|
||||
geom_sf(data = nc_cities) +
|
||||
ggrepel::geom_text_repel(data = nc_cities,
|
||||
aes(x = long, y = lat, label = city)
|
||||
,nudge_y = c(-1,1,1,-1,1)
|
||||
,nudge_x = c(0,0,0,-1,0)
|
||||
) +
|
||||
geom_text(data = . %>% filter(rural == TRUE)
|
||||
,aes(x = center_long, y = center_lat)
|
||||
,label = "R"
|
||||
,color = "#696969"
|
||||
) +
|
||||
# scale_fill_viridis_c(alpha = 0.6, direction = -1) +
|
||||
scale_fill_gradient2(
|
||||
low = "#d01c8b"
|
||||
,mid = "#f7f7f7"
|
||||
,high = "#4dac26"
|
||||
,midpoint = 0
|
||||
) +
|
||||
scale_color_manual(
|
||||
values = c(
|
||||
"FALSE" = "gray"
|
||||
,"TRUE" = "black"
|
||||
),guide = 'none') +
|
||||
labs(
|
||||
title = "Percentage Change of Diagnosed Diabetes 2006-2014"
|
||||
,fill = "Percentage"
|
||||
,y = NULL
|
||||
,x = NULL
|
||||
) +
|
||||
theme(
|
||||
panel.background = element_rect(fill = "aliceblue")
|
||||
,panel.grid.major = element_line(color = "#D4D4D4", linetype = "dashed",
|
||||
size = 0.5)
|
||||
)
|
||||
|
||||
c_g4
|
||||
|
||||
|
||||
# ---- pct_p-histogram ----------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
d4 <- d3 %>%
|
||||
st_drop_geometry() %>%
|
||||
mutate(
|
||||
rural = factor(rural
|
||||
,levels = c(TRUE,FALSE)
|
||||
,labels = c("Rural", "Urban")
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
mean_d4 <- d4 %>%
|
||||
group_by(rural) %>%
|
||||
summarise(.groups = "keep"
|
||||
,pct_c = mean(pct_c)
|
||||
)
|
||||
|
||||
g51 <- d4 %>%
|
||||
ggplot(aes(x = pct_c, fill = rural, y = ..density.., color = rural)) +
|
||||
geom_histogram(binwidth = 5, position = "identity", alpha = 0.3) +
|
||||
geom_density(alpha = 0.5) +
|
||||
facet_wrap(~rural, ncol = 1) +
|
||||
geom_vline(aes(xintercept = pct_c), data = mean_d4) +
|
||||
geom_text(aes(x = pct_c, y = 0.038, label = round(pct_c, 2))
|
||||
,data = mean_d4
|
||||
,hjust = -0.15
|
||||
,size = 5
|
||||
,color = "#000000") +
|
||||
geom_vline(xintercept = 0, linetype = "dashed", color = "#696969") +
|
||||
scale_color_brewer(palette = "Dark2", guide = NULL) +
|
||||
scale_fill_brewer(palette = "Dark2", guide = NULL) +
|
||||
labs(
|
||||
x = "Percentage Change"
|
||||
,y = "Density"
|
||||
,fill = NULL
|
||||
)
|
||||
g51
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
---
|
||||
title: "Diabetes in Rural North Carolina : Exploring Prevalence Trends"
|
||||
subtitle: |
|
||||
This post introduces the exploration of the Diabetes epidemic in North Carolina
|
||||
date: 06-25-2020
|
||||
bibliography: basic_bib.bib
|
||||
csl: apa.csl
|
||||
code-fold: true
|
||||
---
|
||||
|
||||
```{r, echo=FALSE}
|
||||
knitr::read_chunk("diabetes-1.R")
|
||||
```
|
||||
|
||||
# Update
|
||||
|
||||
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 [here](https://www.cdc.gov/diabetes/data/statistics/faqs.html)
|
||||
|
||||
|
||||
# Abstract
|
||||
|
||||
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 [@ADA2015]. 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:
|
||||
|
||||
|
||||
> 1. What is the overall trend of diabetes prevalence in the United States?
|
||||
|
||||
> 2. What is the trend of diabetes at a State Level and how does diabetes prevalence vary by state and region?
|
||||
|
||||
> 3. How do trends in diabetes prevalence vary across counties of North Carolina?
|
||||
|
||||
> 4. In which counties of North Carolina does the largest change in diabetes prevalence occur?
|
||||
|
||||
> 5. How does change in diabetes prevalence compare between rural and urban counties?
|
||||
|
||||
# Enviroment
|
||||
|
||||
___This section contains technical information for deeper analysis and reproduction. Casual readers are invited to skip it.___
|
||||
|
||||
Packages used in this report.
|
||||
|
||||
```{r load-packages}
|
||||
```
|
||||
|
||||
Definitions of global object (file paths, factor levels, object groups ) used throughout the report.
|
||||
|
||||
```{r declare-globals}
|
||||
```
|
||||
|
||||
# Data
|
||||
|
||||
The data for this exploration comes from several sources:
|
||||
|
||||
1. The Diabetes data set for state and county levels were sourced from the US Diabetes Surveillance System; Division of Diabetes Translation - [Centers for Disease Control and Prevention](www.cdc.gov/diabetes/data). The data was downloaded one year per file, and compiled into a single data set for analysis.
|
||||
|
||||
2. The Diabetes data set for National level data were sourced from the CDC's National Health Interview Survey [(NHIS)](https://www.cdc.gov/nchs/nhis/index.htm)
|
||||
|
||||
3. The list of rural counties was taken from The Office of Rural Health Policy, the list is available [here](https://www.hrsa.gov/sites/default/files/hrsa/ruralhealth/resources/forhpeligibleareas.pdf)
|
||||
|
||||
<!-- Load the datasets. -->
|
||||
```{r load-data}
|
||||
```
|
||||
|
||||
<!-- load map data -->
|
||||
```{r load-map-data}
|
||||
```
|
||||
|
||||
# Data Manipulation
|
||||
|
||||
The combined data used in this anaylsis can be downloaded [here](https://github.com/mmmmtoasty19/nc-diabetes-epidemic-2020/blob/master/data-public/derived/nc-diabetes-data.csv).
|
||||
The only tweaks done here are to combine the rural counties column, and the data for creating maps.
|
||||
|
||||
### Tweaks
|
||||
|
||||
<!-- Tweak the datasets. -->
|
||||
```{r tweak-data}
|
||||
```
|
||||
|
||||
### Merge
|
||||
|
||||
<!-- Merge datasets -->
|
||||
```{r merge-data}
|
||||
```
|
||||
|
||||
# Overall - National Level
|
||||
|
||||
```{r o-g1}
|
||||
```
|
||||
|
||||
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 [@CDCP2020].
|
||||
|
||||
# Overall - State Level
|
||||
|
||||
State and County level data on diabetes prevalence are taken from the CDC's Behavioral Risk Factor Surveillance System [(BRFSS)](https://www.cdc.gov/brfss/index.html). 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.[@Pierannunzi2012]
|
||||
|
||||
|
||||
```{r s-g1}
|
||||
```
|
||||
|
||||
The above graph shows diabetes prevalence trends by state, grouped into regions based on the US Census classification [regions](https://www2.census.gov/geo/pdfs/maps-data/maps/reference/us_regdiv.pdf). 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.
|
||||
|
||||
```{r s-g2}
|
||||
```
|
||||
|
||||
When focusing on the south region, North Carolina falls close to the middle of diabetes prevalence.
|
||||
|
||||
# Overall - North Carolina
|
||||
|
||||
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.
|
||||
|
||||
```{r nc-g1}
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
|
||||
```{r nc-data-aberration}
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
|
||||
```{r nc-g2}
|
||||
```
|
||||
|
||||
|
||||
# By County - Geographical
|
||||
|
||||
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[@Rao2003 ; @Barker2013]. 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[@Klein2001].
|
||||
|
||||
```{r spaghetti-plot}
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
```{r c-g1}
|
||||
#| column: body-outset
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
|
||||
```{r county-boxplot}
|
||||
```
|
||||
|
||||
# By County - Percent Change
|
||||
|
||||
The following graphs display the overall change in estimated prevalence between 2006 to 2014.
|
||||
|
||||
```{r c-g4}
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
```{r pct_p-histogram}
|
||||
```
|
||||
|
||||
|
||||
# Conclusion and Next Steps
|
||||
|
||||
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.
|
||||
|
||||
|
||||
# Session information
|
||||
|
||||
===========================================================================
|
||||
|
||||
For the sake of documentation and reproducibility, the current report was rendered in the following environment. Click the line below to expand.
|
||||
|
||||
<details>
|
||||
<summary>Environment <span class="glyphicon glyphicon-plus-sign"></span></summary>
|
||||
```{r session-info}
|
||||
if( requireNamespace("devtools", quietly = TRUE) ) {
|
||||
devtools::session_info()
|
||||
} else {
|
||||
sessionInfo()
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
# References
|
||||
|
||||
|
|
@ -3,6 +3,7 @@ title: "Converting From Blogdown to Distill"
|
|||
subtitle: |
|
||||
A meta post on transferring from a blogdown to distill blog site
|
||||
date: 01-12-2021
|
||||
date-modified: 10-12-2023
|
||||
categories:
|
||||
- Distill
|
||||
---
|
||||
|
|
96
posts/2022-07-28_making-maps-in-R/making-maps-in-r.R
Normal file
|
@ -0,0 +1,96 @@
|
|||
#These first few lines run only when the file is run in RStudio, !!NOT when an Rmd/Rnw file calls it!!
|
||||
rm(list=ls(all=TRUE)) #Clear the variables from previous runs.
|
||||
cat("\f") # clear console
|
||||
|
||||
# ---- load-packages --------------------------------------------------
|
||||
# Attach these packages so their functions don't need to be qualified: http://r-pkgs.had.co.nz/namespace.html#search-path
|
||||
library(tidyverse)
|
||||
library(ggmap)
|
||||
library(highcharter)
|
||||
|
||||
|
||||
# ---- load-sources ---------------------------------------------------
|
||||
|
||||
|
||||
|
||||
# ---- declare-globals ----------------------------------------------------
|
||||
|
||||
|
||||
|
||||
# ---- load-data ------------------------------------------------------
|
||||
|
||||
# load data from Tidy Tuesday 3//01/22
|
||||
# https://github.com/rfordatascience/tidytuesday/blob/master/data/2022/2022-03-01/readme.md
|
||||
|
||||
ev_stations <- tidytuesdayR::tt_load(2022, week = 9) %>% .$stations
|
||||
|
||||
ds1 <- ev_stations %>%
|
||||
filter(STATE == "NC") %>%
|
||||
select(LATITUDE, LONGITUDE, STATION_NAME, FUEL_TYPE_CODE, STATE, CITY) %>%
|
||||
rename(lat = LATITUDE, lon = LONGITUDE, name = STATION_NAME)
|
||||
|
||||
|
||||
# ggmap -------------------------------------------------------------------
|
||||
|
||||
# Using GGMAP to create map of NC EV Staions
|
||||
|
||||
nc_boundries <- c(-85, 33.5, -75, 37)
|
||||
|
||||
get_stamenmap(bbox = nc_boundries, zoom = 7, map = "toner") %>% ggmap() +
|
||||
geom_point(data = ds1, aes(x = lon, y = lat, fill = FUEL_TYPE_CODE), shape = 21, size = 3) +
|
||||
scale_fill_brewer(palette = "Dark2") +
|
||||
theme_void() +
|
||||
theme(legend.position = "bottom"
|
||||
,plot.title = element_text(hjust = 0.5, margin=margin(0,0,30,0)) #center title and add space due to theme
|
||||
) +
|
||||
guides( #use to move legend title to the top, default is to the side
|
||||
fill = guide_legend(title.position = "top", title.hjust = 0.5)
|
||||
) +
|
||||
labs(
|
||||
title = "Alternate Fuel Stations in North Carolina"
|
||||
,fill = "Station Type"
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# create map --------------------------------------------------------------
|
||||
|
||||
hcmap("countries/us/us-nc-all", showInLegend = FALSE)
|
||||
|
||||
colors <- c('#8c510a','#d8b365','#f6e8c3','#c7eae5','#5ab4ac','#01665e')
|
||||
|
||||
|
||||
|
||||
ds1 <- ev_stations %>%
|
||||
filter(STATE == "NC") %>%
|
||||
select(LATITUDE, LONGITUDE, STATION_NAME, FUEL_TYPE_CODE) %>%
|
||||
rename(lat = LATITUDE, lon = LONGITUDE, name = STATION_NAME) %>%
|
||||
mutate(color = colorize(FUEL_TYPE_CODE, colors))
|
||||
|
||||
|
||||
|
||||
hc1 <- hcmap("countries/us/us-nc-all", showInLegend = FALSE
|
||||
,nullColor = "black" #use to set map background color
|
||||
,borderColor = "pink" #change the colors of the borders!
|
||||
) %>%
|
||||
hc_add_series(
|
||||
data = ds1
|
||||
,type = "mappoint"
|
||||
,dataLabels = list(enabled = FALSE)
|
||||
,tooltip = list(pointFormat = "{point.name}")
|
||||
,marker = list(lineWidth = 0, radius = 3, symbol = 'circle')
|
||||
,hcaes(color = color
|
||||
,group = FUEL_TYPE_CODE
|
||||
) #use this to add the color and group to each point
|
||||
,color = colors # use this to set the color of the series in the legend
|
||||
) %>%
|
||||
hc_title(text = "Alternate Fuel Stations in North Carolina")
|
||||
#note no legend title. No default way to center legend title and I don't like the look of it
|
||||
|
||||
|
||||
hc1
|
18
posts/2022-07-28_making-maps-in-R/making-maps-in-r.qmd
Normal file
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
title: "Making Maps in R"
|
||||
subtitle: |
|
||||
A short description of the post.
|
||||
date: 2022-07-28
|
||||
draft: true
|
||||
---
|
||||
|
||||
|
||||
```{r setup, include=FALSE}
|
||||
knitr::opts_chunk$set(echo = FALSE)
|
||||
```
|
||||
|
||||
Distill is a publication format for scientific and technical writing, native to the web.
|
||||
|
||||
Learn more about using Distill at <https://rstudio.github.io/distill>.
|
||||
|
||||
|