-
Notifications
You must be signed in to change notification settings - Fork 0
Mathatistics/NIVA-ExposureAnalysis
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
<!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.2.335"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> <meta name="author" content="Raju Rimal"> <meta name="dcterms.date" content="2024-05-12"> <title>Spatio-Temporal Exposure Analysis</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 -1.6em; vertical-align: middle; } 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; color: #aaaaaa; } pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } div.sourceCode { } @media screen { pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } } code span.al { color: #ff0000; font-weight: bold; } /* Alert */ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ code span.at { color: #7d9029; } /* Attribute */ code span.bn { color: #40a070; } /* BaseN */ code span.bu { color: #008000; } /* BuiltIn */ code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ code span.ch { color: #4070a0; } /* Char */ code span.cn { color: #880000; } /* Constant */ code span.co { color: #60a0b0; font-style: italic; } /* Comment */ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ code span.do { color: #ba2121; font-style: italic; } /* Documentation */ code span.dt { color: #902000; } /* DataType */ code span.dv { color: #40a070; } /* DecVal */ code span.er { color: #ff0000; font-weight: bold; } /* Error */ code span.ex { } /* Extension */ code span.fl { color: #40a070; } /* Float */ code span.fu { color: #06287e; } /* Function */ code span.im { color: #008000; font-weight: bold; } /* Import */ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ code span.kw { color: #007020; font-weight: bold; } /* Keyword */ code span.op { color: #666666; } /* Operator */ code span.ot { color: #007020; } /* Other */ code span.pp { color: #bc7a00; } /* Preprocessor */ code span.sc { color: #4070a0; } /* SpecialChar */ code span.ss { color: #bb6688; } /* SpecialString */ code span.st { color: #4070a0; } /* String */ code span.va { color: #19177c; } /* Variable */ code span.vs { color: #4070a0; } /* VerbatimString */ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ </style> <script src="README_files/libs/clipboard/clipboard.min.js"></script> <script src="README_files/libs/quarto-html/quarto.js"></script> <script src="README_files/libs/quarto-html/popper.min.js"></script> <script src="README_files/libs/quarto-html/tippy.umd.min.js"></script> <script src="README_files/libs/quarto-html/anchor.min.js"></script> <link href="README_files/libs/quarto-html/tippy.css" rel="stylesheet"> <link href="README_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles"> <script src="README_files/libs/bootstrap/bootstrap.min.js"></script> <link href="README_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet"> <link href="README_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light"> <script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js" type="text/javascript"></script> </head> <body class="fullcontent"> <div id="quarto-content" class="page-columns page-rows-contents page-layout-article"> <main class="content" id="quarto-document-content"> <header id="title-block-header" class="quarto-title-block default"> <div class="quarto-title"> <h1 class="title">Spatio-Temporal Exposure Analysis</h1> </div> <div class="quarto-title-meta"> <div> <div class="quarto-title-meta-heading">Author</div> <div class="quarto-title-meta-contents"> <p>Raju Rimal </p> </div> </div> <div> <div class="quarto-title-meta-heading">Published</div> <div class="quarto-title-meta-contents"> <p class="date">May 12, 2024</p> </div> </div> </div> </header> <div class="cell"> <details> <summary>Local functions</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>get_tissue_conc <span class="ot"><-</span> <span class="cf">function</span>(cw, logp) {</span> <span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a> cf <span class="ot"><-</span> cw <span class="sc">*</span> <span class="dv">10</span> <span class="sc">^</span>(<span class="fl">0.76</span> <span class="sc">*</span> logp <span class="sc">-</span> <span class="fl">0.23</span>)</span> <span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">return</span>(cf)</span> <span id="cb1-4"><a href="#cb1-4" 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> <section id="dataset" class="level2"> <h2 class="anchored" data-anchor-id="dataset">Dataset</h2> <p>In this analysis we will use the exposure data available at <a href="https://zenodo.org/records/11093687" title="Spatio-temporal dataset - Exposure data">zenodo ((https://doi.org/10.5281/zenodo.11093687))</a>. The dataset contains exposure information from 6-location in Norway from the year 2019.</p> <div class="cell"> <details> <summary>Sample sites in Norway</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>csmaps<span class="sc">::</span>nor_municip_map_b2020_split_dt <span class="sc">%>%</span> </span> <span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(long, lat, <span class="at">group =</span> group)) <span class="sc">+</span></span> <span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_polygon</span>(<span class="at">fill =</span> <span class="cn">NA</span>, <span class="at">color =</span> <span class="st">"darkgrey"</span>, <span class="at">linewidth =</span> <span class="fl">0.1</span>) <span class="sc">+</span></span> <span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_label</span>(</span> <span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> <span class="at">data =</span> site_data, </span> <span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span>(<span class="at">x =</span> LONGITUDE, <span class="at">y =</span> LATITUDE, <span class="at">label =</span> SITE_NAME),</span> <span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a> <span class="at">group =</span> <span class="dv">1</span>,</span> <span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a> <span class="at">size =</span> <span class="fu">rel</span>(<span class="dv">3</span>),</span> <span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a> <span class="at">hjust =</span> <span class="sc">-</span><span class="fl">0.1</span>,</span> <span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a> <span class="at">label.r =</span> <span class="fu">unit</span>(<span class="fl">2.5</span>, <span class="st">"pt"</span>)</span> <span id="cb2-11"><a href="#cb2-11" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span> <span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_point</span>(</span> <span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a> <span class="at">data =</span> site_data, </span> <span id="cb2-14"><a href="#cb2-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span>(<span class="at">x =</span> LONGITUDE, <span class="at">y =</span> LATITUDE),</span> <span id="cb2-15"><a href="#cb2-15" aria-hidden="true" tabindex="-1"></a> <span class="at">group =</span> <span class="dv">1</span>,</span> <span id="cb2-16"><a href="#cb2-16" aria-hidden="true" tabindex="-1"></a> <span class="at">color =</span> <span class="st">"firebrick"</span></span> <span id="cb2-17"><a href="#cb2-17" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span> <span id="cb2-18"><a href="#cb2-18" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme_void</span>() <span class="sc">+</span></span> <span id="cb2-19"><a href="#cb2-19" aria-hidden="true" tabindex="-1"></a> <span class="fu">coord_map</span>() <span class="sc">+</span></span> <span id="cb2-20"><a href="#cb2-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span> <span id="cb2-21"><a href="#cb2-21" aria-hidden="true" tabindex="-1"></a> <span class="at">title =</span> <span class="st">"Monitoring sites of Spatio-temporal exposure data"</span>,</span> <span id="cb2-22"><a href="#cb2-22" aria-hidden="true" tabindex="-1"></a> <span class="at">subtitle =</span> <span class="st">"Year: 2019, Country: Norway"</span></span> <span id="cb2-23"><a href="#cb2-23" 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-display"> <p><img src="README_files/figure-html/Map%20sample%20site-1.png" class="img-fluid" style="width:100.0%"></p> </div> </div> <p>In each of these locations, levels of various stressors were measured in [Freshwater] between dates [mai 06, 2019 and oktober 28, 2019].</p> <p>Further, the chemical properties of stressor such as “MolecularWeight” and partition coefficient (LogP or XLogP) are extracted using <code>webchem::pc_prop</code> command from <code>webchem</code> package using compound ID. The Compound ID were fetched using the command <code>webchem::get_cid</code> using the <code>INCHIKEY</code> variable available in the dataset.</p> <p>The effect of these stressor were also calculated in fish tissues using the level of water concentration and partition coefficient (XLotP) as,</p> <p><span class="math display">\[\texttt{fish concentration} = \texttt{water concentration} \times 10 ^{0.76 \times \log P - 0.23}, \text{unit: ug/Kg}\]</span></p> <div class="cell"> <details> <summary>Calculate stressor concentration in fish tissue</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>exposure_data <span class="ot"><-</span> exposure_data <span class="sc">%>%</span> </span> <span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">FishConc =</span> <span class="fu">get_tissue_conc</span>(MEASURED_VALUE, XLogP))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div> </details> </div> <p>The average level of contration of each stressor in these location is as follows.</p> </section> <section id="average-level-of-stressor" class="level2"> <h2 class="anchored" data-anchor-id="average-level-of-stressor">Average level of stressor</h2> <div class="cell" data-fig.asp="0.9"> <details> <summary>Average concentration of stressor in each site</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>exposure_data <span class="sc">%>%</span> </span> <span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">rename</span>(<span class="at">WaterConc =</span> MEASURED_VALUE) <span class="sc">%>%</span> </span> <span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_longer</span>(<span class="at">cols =</span> <span class="fu">ends_with</span>(<span class="st">"Conc"</span>)) <span class="sc">%>%</span> </span> <span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">group_by</span>(STRESSOR_NAME, SITE_NAME, name) <span class="sc">%>%</span> </span> <span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">summarize</span>(<span class="fu">across</span>(value, <span class="cf">function</span>(x) {</span> <span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> Hmisc<span class="sc">::</span><span class="fu">smean.cl.normal</span>(x) <span class="sc">%>%</span> </span> <span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">as.list</span>() <span class="sc">%>%</span> </span> <span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">bind_cols</span>() <span class="sc">%>%</span> </span> <span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">list</span>()</span> <span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a> })) <span class="sc">%>%</span> </span> <span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">unnest</span>() <span class="sc">%>%</span> </span> <span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(Mean, STRESSOR_NAME, <span class="at">color =</span> name)) <span class="sc">+</span></span> <span id="cb4-13"><a href="#cb4-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">facet_grid</span>(<span class="at">cols =</span> <span class="fu">vars</span>(SITE_NAME)) <span class="sc">+</span></span> <span id="cb4-14"><a href="#cb4-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_pointrange</span>(</span> <span id="cb4-15"><a href="#cb4-15" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span>(<span class="at">xmin =</span> Lower, <span class="at">xmax =</span> Upper),</span> <span id="cb4-16"><a href="#cb4-16" aria-hidden="true" tabindex="-1"></a> <span class="at">shape =</span> <span class="dv">21</span>, <span class="at">fill =</span> <span class="st">"whitesmoke"</span>,</span> <span id="cb4-17"><a href="#cb4-17" aria-hidden="true" tabindex="-1"></a> <span class="at">stroke =</span> <span class="dv">1</span></span> <span id="cb4-18"><a href="#cb4-18" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span> <span id="cb4-19"><a href="#cb4-19" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_x_log10</span>(<span class="at">breaks =</span> scales<span class="sc">::</span><span class="fu">breaks_log</span>(<span class="dv">4</span>)) <span class="sc">+</span></span> <span id="cb4-20"><a href="#cb4-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_color_brewer</span>(</span> <span id="cb4-21"><a href="#cb4-21" aria-hidden="true" tabindex="-1"></a> <span class="at">palette =</span> <span class="st">"Set1"</span>,</span> <span id="cb4-22"><a href="#cb4-22" aria-hidden="true" tabindex="-1"></a> <span class="at">labels =</span> <span class="fu">c</span>(</span> <span id="cb4-23"><a href="#cb4-23" aria-hidden="true" tabindex="-1"></a> <span class="at">WaterConc =</span> <span class="st">"Water concentration (ug/L)"</span>,</span> <span id="cb4-24"><a href="#cb4-24" aria-hidden="true" tabindex="-1"></a> <span class="at">FishConc =</span> <span class="st">"Fish concentration (ug/Kg)"</span></span> <span id="cb4-25"><a href="#cb4-25" aria-hidden="true" tabindex="-1"></a> )</span> <span id="cb4-26"><a href="#cb4-26" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span> <span id="cb4-27"><a href="#cb4-27" aria-hidden="true" tabindex="-1"></a> ggthemes<span class="sc">::</span><span class="fu">theme_few</span>() <span class="sc">+</span></span> <span id="cb4-28"><a href="#cb4-28" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme</span>(</span> <span id="cb4-29"><a href="#cb4-29" aria-hidden="true" tabindex="-1"></a> <span class="at">panel.grid =</span> <span class="fu">element_line</span>(<span class="at">color =</span> <span class="st">"#f0f0f0"</span>),</span> <span id="cb4-30"><a href="#cb4-30" aria-hidden="true" tabindex="-1"></a> <span class="at">legend.position =</span> <span class="st">"bottom"</span>,</span> <span id="cb4-31"><a href="#cb4-31" aria-hidden="true" tabindex="-1"></a> <span class="at">legend.justification =</span> <span class="st">"left"</span></span> <span id="cb4-32"><a href="#cb4-32" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span> <span id="cb4-33"><a href="#cb4-33" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span> <span id="cb4-34"><a href="#cb4-34" aria-hidden="true" tabindex="-1"></a> <span class="at">x =</span> <span class="st">"log10(Contration level)"</span>,</span> <span id="cb4-35"><a href="#cb4-35" aria-hidden="true" tabindex="-1"></a> <span class="at">title =</span> <span class="st">"Average contration of stressors in each location"</span>,</span> <span id="cb4-36"><a href="#cb4-36" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> <span class="cn">NULL</span>,</span> <span id="cb4-37"><a href="#cb4-37" aria-hidden="true" tabindex="-1"></a> <span class="at">color =</span> <span class="cn">NULL</span></span> <span id="cb4-38"><a href="#cb4-38" 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-display"> <p><img src="README_files/figure-html/Average%20exposure-1.png" class="img-fluid" style="width:100.0%"></p> </div> </div> <div class="cell" data-fig.asp="0.6"> <details> <summary>Average concentration of stressor (heatmap)</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>exposure_data <span class="sc">%>%</span></span> <span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">rename</span>(<span class="at">WaterConc =</span> MEASURED_VALUE) <span class="sc">%>%</span> </span> <span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_longer</span>(<span class="at">cols =</span> <span class="fu">ends_with</span>(<span class="st">"Conc"</span>)) <span class="sc">%>%</span> </span> <span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">group_by</span>(SITE_NAME, STRESSOR_NAME, name) <span class="sc">%>%</span> </span> <span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">summarize</span>(<span class="fu">across</span>(value, <span class="cf">function</span>(x) {</span> <span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a> Hmisc<span class="sc">::</span><span class="fu">smean.cl.normal</span>(x) <span class="sc">%>%</span> </span> <span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">as.list</span>() <span class="sc">%>%</span> </span> <span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">bind_cols</span>() <span class="sc">%>%</span> </span> <span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">list</span>()</span> <span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a> })) <span class="sc">%>%</span> </span> <span id="cb5-11"><a href="#cb5-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">unnest</span>() <span class="sc">%>%</span> </span> <span id="cb5-12"><a href="#cb5-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(STRESSOR_NAME, SITE_NAME, <span class="at">fill =</span> Mean)) <span class="sc">+</span></span> <span id="cb5-13"><a href="#cb5-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">facet_grid</span>(<span class="at">rows =</span> <span class="fu">vars</span>(name), <span class="at">labeller =</span> <span class="fu">labeller</span>(</span> <span id="cb5-14"><a href="#cb5-14" aria-hidden="true" tabindex="-1"></a> <span class="at">name =</span> <span class="fu">c</span>(</span> <span id="cb5-15"><a href="#cb5-15" aria-hidden="true" tabindex="-1"></a> <span class="at">FishConc =</span> <span class="st">"Fish</span><span class="sc">\n</span><span class="st">concentration</span><span class="sc">\n</span><span class="st">(ug/Kg)"</span>,</span> <span id="cb5-16"><a href="#cb5-16" aria-hidden="true" tabindex="-1"></a> <span class="at">WaterConc =</span> <span class="st">"Water</span><span class="sc">\n</span><span class="st">concentration</span><span class="sc">\n</span><span class="st">(ug/L)"</span></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> )) <span class="sc">+</span></span> <span id="cb5-19"><a href="#cb5-19" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_tile</span>(<span class="at">color =</span> <span class="st">"#f0f0f0"</span>, <span class="at">linewidth =</span> <span class="fl">0.1</span>) <span class="sc">+</span></span> <span id="cb5-20"><a href="#cb5-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_fill_viridis_c</span>(</span> <span id="cb5-21"><a href="#cb5-21" aria-hidden="true" tabindex="-1"></a> <span class="at">trans =</span> <span class="st">"log"</span>, <span class="at">na.value =</span> <span class="st">"white"</span>, </span> <span id="cb5-22"><a href="#cb5-22" aria-hidden="true" tabindex="-1"></a> <span class="at">breaks =</span> scales<span class="sc">::</span><span class="fu">breaks_log</span>(<span class="dv">10</span>),</span> <span id="cb5-23"><a href="#cb5-23" aria-hidden="true" tabindex="-1"></a> <span class="at">labels =</span> \(x) <span class="fu">formatC</span>(x, <span class="at">format =</span> <span class="st">"f"</span>, <span class="at">flag =</span> <span class="dv">0</span>, <span class="at">digits =</span> <span class="dv">3</span>),</span> <span id="cb5-24"><a href="#cb5-24" aria-hidden="true" tabindex="-1"></a> <span class="at">guide =</span> <span class="fu">guide_colorbar</span>(<span class="at">barwidth =</span> <span class="fu">unit</span>(<span class="fl">0.8</span>, <span class="st">"npc"</span>))</span> <span id="cb5-25"><a href="#cb5-25" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span> <span id="cb5-26"><a href="#cb5-26" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_x_discrete</span>(<span class="at">guide =</span> <span class="fu">guide_axis</span>(<span class="at">angle =</span> <span class="dv">45</span>)) <span class="sc">+</span></span> <span id="cb5-27"><a href="#cb5-27" aria-hidden="true" tabindex="-1"></a> <span class="fu">coord_equal</span>() <span class="sc">+</span></span> <span id="cb5-28"><a href="#cb5-28" aria-hidden="true" tabindex="-1"></a> ggthemes<span class="sc">::</span><span class="fu">theme_few</span>() <span class="sc">+</span></span> <span id="cb5-29"><a href="#cb5-29" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme</span>(</span> <span id="cb5-30"><a href="#cb5-30" aria-hidden="true" tabindex="-1"></a> <span class="at">legend.position =</span> <span class="st">"top"</span></span> <span id="cb5-31"><a href="#cb5-31" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span> <span id="cb5-32"><a href="#cb5-32" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">y =</span> <span class="cn">NULL</span>, <span class="at">x =</span> <span class="cn">NULL</span>, <span class="at">fill =</span> <span class="cn">NULL</span>)</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="README_files/figure-html/Average%20exposure%20heatmap-1.png" class="img-fluid" style="width:100.0%"></p> </div> </div> </section> <section id="distribution-of-concentration" class="level2"> <h2 class="anchored" data-anchor-id="distribution-of-concentration">Distribution of concentration</h2> <p>Water concentration (ug/L) of these stressor are skewed towards zero with long right tail. In one of the location (Timebekken), because of small sample size, the distribution is not clear.</p> <div class="cell" data-fig.asp="0.6"> <details> <summary>Distribution of concentration level</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>exposure_data <span class="sc">%>%</span> </span> <span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">rename</span>(<span class="at">WaterConc =</span> MEASURED_VALUE) <span class="sc">%>%</span> </span> <span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_longer</span>(<span class="at">cols =</span> <span class="fu">ends_with</span>(<span class="st">"Conc"</span>)) <span class="sc">%>%</span> </span> <span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(value)) <span class="sc">+</span></span> <span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">facet_grid</span>(</span> <span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a> <span class="at">rows =</span> <span class="fu">vars</span>(name),</span> <span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a> <span class="at">cols =</span> <span class="fu">vars</span>(SITE_NAME), </span> <span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a> <span class="at">scales =</span> <span class="st">"free"</span>,</span> <span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a> <span class="at">labeller =</span> <span class="fu">labeller</span>(</span> <span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a> <span class="at">name =</span> <span class="fu">c</span>(</span> <span id="cb6-11"><a href="#cb6-11" aria-hidden="true" tabindex="-1"></a> <span class="at">FishConc =</span> <span class="st">"Fish concentration</span><span class="sc">\n</span><span class="st">(ug/Kg)"</span>,</span> <span id="cb6-12"><a href="#cb6-12" aria-hidden="true" tabindex="-1"></a> <span class="at">WaterConc =</span> <span class="st">"Water concentration</span><span class="sc">\n</span><span class="st">(ug/L)"</span></span> <span id="cb6-13"><a href="#cb6-13" aria-hidden="true" tabindex="-1"></a> )</span> <span id="cb6-14"><a href="#cb6-14" aria-hidden="true" tabindex="-1"></a> )</span> <span id="cb6-15"><a href="#cb6-15" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span> <span id="cb6-16"><a href="#cb6-16" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_histogram</span>(</span> <span id="cb6-17"><a href="#cb6-17" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span>(<span class="at">y =</span> <span class="fu">after_stat</span>(density)), </span> <span id="cb6-18"><a href="#cb6-18" aria-hidden="true" tabindex="-1"></a> <span class="at">bins =</span> <span class="dv">10</span>, <span class="at">linewidth =</span> <span class="fl">0.5</span>,</span> <span id="cb6-19"><a href="#cb6-19" aria-hidden="true" tabindex="-1"></a> <span class="at">fill =</span> <span class="st">"whitesmoke"</span>, </span> <span id="cb6-20"><a href="#cb6-20" aria-hidden="true" tabindex="-1"></a> <span class="at">color =</span> <span class="st">"#3d3d3d"</span></span> <span id="cb6-21"><a href="#cb6-21" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">+</span></span> <span id="cb6-22"><a href="#cb6-22" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_density</span>(<span class="at">color =</span> <span class="st">"forestgreen"</span>, <span class="at">linewidth =</span> <span class="dv">1</span>) <span class="sc">+</span></span> <span id="cb6-23"><a href="#cb6-23" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_rug</span>(<span class="at">length =</span> <span class="fu">unit</span>(<span class="dv">5</span>, <span class="st">"pt"</span>), <span class="at">alpha =</span> <span class="fl">0.5</span>) <span class="sc">+</span></span> <span id="cb6-24"><a href="#cb6-24" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_x_log10</span>(<span class="at">breaks =</span> scales<span class="sc">::</span><span class="fu">breaks_log</span>(<span class="dv">4</span>)) <span class="sc">+</span></span> <span id="cb6-25"><a href="#cb6-25" aria-hidden="true" tabindex="-1"></a> ggthemes<span class="sc">::</span><span class="fu">theme_few</span>() <span class="sc">+</span></span> <span id="cb6-26"><a href="#cb6-26" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme</span>(<span class="at">panel.grid =</span> <span class="fu">element_line</span>(<span class="at">color =</span> <span class="st">"#f0f0f0"</span>)) <span class="sc">+</span></span> <span id="cb6-27"><a href="#cb6-27" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(</span> <span id="cb6-28"><a href="#cb6-28" aria-hidden="true" tabindex="-1"></a> <span class="at">x =</span> <span class="st">"log10(Stressor concentration)"</span>,</span> <span id="cb6-29"><a href="#cb6-29" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> <span class="st">"Density"</span></span> <span id="cb6-30"><a href="#cb6-30" 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-display"> <p><img src="README_files/figure-html/Distribution%20of%20measured%20values-1.png" class="img-fluid" style="width:100.0%"></p> </div> </div> </section> <section id="shiny-app-for-exploration" class="level2"> <h2 class="anchored" data-anchor-id="shiny-app-for-exploration">Shiny App for Exploration</h2> <p>A <a href="https://therimalaya.shinyapps.io/NIVA-AppExposure/">shiny app</a> can help to explore the data further. To run the shiny app from the local computer,</p> <div class="cell"> <details open=""> <summary>Run Shiny Application</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>shiny<span class="sc">::</span><span class="fu">runGitHub</span>(</span> <span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a> <span class="at">username =</span> <span class="st">"Mathatistics"</span>, </span> <span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a> <span class="at">repo =</span> <span class="st">"NIVA-ExposureAnalysis"</span>, </span> <span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a> <span class="at">subdir =</span> <span class="st">"ShinyApp/"</span>,</span> <span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a> <span class="at">ref =</span> <span class="st">"main"</span></span> <span id="cb7-6"><a href="#cb7-6" 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> </section> </main> <!-- /main column --> <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 clipboard = new window.ClipboardJS('.code-copy-button', { target: function(trigger) { return trigger.previousElementSibling; } }); 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; }); } 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>