Deploying to gh-pages from @ agdamsbo/FreesearchR@2d062e0ac5 🚀

This commit is contained in:
agdamsbo 2026-03-23 13:50:03 +00:00
commit 66780fc453
44 changed files with 1145 additions and 190 deletions

View file

@ -0,0 +1,157 @@
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Run a startup version check and return a banner UI element — check_app_version • FreesearchR</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/Montserrat-0.4.10/font.css" rel="stylesheet"><link href="../deps/Public_Sans-0.4.10/font.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet"><meta property="og:title" content="Run a startup version check and return a banner UI element — check_app_version"><meta name="description" content="Call this outside server() typically in
global.R or at the top of app.R and embed the returned
value directly in your UI definition. Because the check runs at startup
the banner is present on first render with no loading delay, and no
uiOutput() / renderUI() wiring is needed."><meta property="og:description" content="Call this outside server() typically in
global.R or at the top of app.R and embed the returned
value directly in your UI definition. Because the check runs at startup
the banner is present on first render with no loading delay, and no
uiOutput() / renderUI() wiring is needed."><meta property="og:image" content="https://agdamsbo.github.io/FreesearchR/logo.png"><script defer src="https://stats.freesearchr.org/script.js" data-website-id="85bfd1e8-2cbe-4a4a-aa34-1dfb2960905b"></script></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
<nav class="navbar navbar-expand-lg fixed-top bg-primary" data-bs-theme="dark" aria-label="Site navigation"><div class="container">
<a class="navbar-brand me-2" href="../index.html">FreesearchR</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">26.3.4</small>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar" class="collapse navbar-collapse ms-3">
<ul class="navbar-nav me-auto"><li class="nav-item"><a class="nav-link" href="../articles/FreesearchR.html">Get started</a></li>
<li class="active nav-item"><a class="nav-link" href="../reference/index.html">Reference</a></li>
<li class="nav-item dropdown">
<button class="nav-link dropdown-toggle" type="button" id="dropdown-articles" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true">Articles</button>
<ul class="dropdown-menu" aria-labelledby="dropdown-articles"><li><a class="dropdown-item" href="../articles/data-types.html">Data types</a></li>
<li><a class="dropdown-item" href="../articles/missingness.html">Missingness in data</a></li>
<li><a class="dropdown-item" href="../articles/session.html">Session info</a></li>
<li><a class="dropdown-item" href="../articles/visuals.html">On visuals</a></li>
</ul></li>
<li class="nav-item"><a class="nav-link" href="../ROADMAP.html">Roadmap</a></li>
<li class="nav-item"><a class="nav-link" href="../QA.html">Q&amp;A</a></li>
<li class="nav-item"><a class="nav-link" href="../news/index.html">Changelog</a></li>
</ul><ul class="navbar-nav"><li class="nav-item"><form class="form-inline" role="search">
<input class="form-control" type="search" name="search-input" id="search-input" autocomplete="off" aria-label="Search site" placeholder="Search for" data-search-index="../search.json"></form></li>
<li class="nav-item"><a class="external-link nav-link" href="https://github.com/agdamsbo/FreesearchR/" aria-label="GitHub"><span class="fa fab fa-github fa-lg"></span></a></li>
</ul></div>
</div>
</nav><div class="container template-reference-topic">
<div class="row">
<main id="main" class="col-md-9"><div class="page-header">
<img src="../logo.png" class="logo" alt=""><h1>Run a startup version check and return a banner UI element</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/FreesearchR/blob/main/R/version_check.R" class="external-link"><code>R/version_check.R</code></a></small>
<div class="d-none name"><code>check_app_version.Rd</code></div>
</div>
<div class="ref-description section level2">
<p>Call this <strong>outside</strong> <code>server()</code> typically in
<code>global.R</code> or at the top of <code>app.R</code> and embed the returned
value directly in your UI definition. Because the check runs at startup
the banner is present on first render with no loading delay, and no
<code>uiOutput()</code> / <code>renderUI()</code> wiring is needed.</p>
</div>
<div class="section level2">
<h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">check_app_version</span><span class="op">(</span></span>
<span> <span class="va">github_user</span>,</span>
<span> <span class="va">github_repo</span>,</span>
<span> app_version <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span> verbose <span class="op">=</span> <span class="cn">FALSE</span></span>
<span><span class="op">)</span></span></code></pre></div>
</div>
<div class="section level2">
<h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a></h2>
<dl><dt id="arg-github-user">github_user<a class="anchor" aria-label="anchor" href="#arg-github-user"></a></dt>
<dd><p>GitHub username or organisation that owns the repository.</p></dd>
<dt id="arg-github-repo">github_repo<a class="anchor" aria-label="anchor" href="#arg-github-repo"></a></dt>
<dd><p>Repository name. Also used as the package name for
<code><a href="https://rdrr.io/r/utils/packageDescription.html" class="external-link">utils::packageVersion()</a></code>.</p></dd>
<dt id="arg-app-version">app_version<a class="anchor" aria-label="anchor" href="#arg-app-version"></a></dt>
<dd><p>Optional fallback version string for environments where
the package is not installed (e.g. shinyapps.io). Pass the result of your
<code>app_version()</code> function here. Ignored when <code><a href="https://rdrr.io/r/utils/packageDescription.html" class="external-link">packageVersion()</a></code>
succeeds.</p></dd>
<dt id="arg-verbose">verbose<a class="anchor" aria-label="anchor" href="#arg-verbose"></a></dt>
<dd><p>Logical; if <code>TRUE</code> a banner is always returned.
Defaults to <code>FALSE</code>.</p></dd>
</dl></div>
<div class="section level2">
<h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
<p>A <code><a href="https://dreamrs.github.io/shinyWidgets/reference/bootstrap-utils.html" class="external-link">shinyWidgets::alert()</a></code> UI element, or <code>NULL</code> when there
is nothing to show (up to date in non-verbose mode).</p>
</div>
<div class="section level2">
<h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
<p><strong>Normal mode</strong> (<code>verbose = FALSE</code>): returns a banner only when
a newer version is available or when the check fails. Returns <code>NULL</code>
when the app is up to date (Shiny silently ignores <code>NULL</code> in the UI).</p>
<p><strong>Verbose / debug mode</strong> (<code>verbose = TRUE</code>): always returns a
banner including a success banner when up to date so you can confirm
the check ran and inspect both version strings during development.</p>
</div>
<div class="section level2">
<h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="cn">FALSE</span><span class="op">)</span> <span class="op">{</span> <span class="co"># \dontrun{</span></span></span>
<span class="r-in"><span><span class="co"># global.R or top of app.R</span></span></span>
<span class="r-in"><span><span class="kw"><a href="https://rdrr.io/r/base/source.html" class="external-link">source</a></span><span class="op">(</span><span class="st">"version_check.R"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">version_banner</span> <span class="op">&lt;-</span> <span class="fu">check_app_version</span><span class="op">(</span></span></span>
<span class="r-in"><span> github_user <span class="op">=</span> <span class="st">"my-org"</span>,</span></span>
<span class="r-in"><span> github_repo <span class="op">=</span> <span class="st">"my-shiny-app"</span>,</span></span>
<span class="r-in"><span> app_version <span class="op">=</span> <span class="fu">app_version</span><span class="op">(</span><span class="op">)</span> <span class="co"># fallback for shinyapps.io</span></span></span>
<span class="r-in"><span><span class="op">)</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># ui.R</span></span></span>
<span class="r-in"><span><span class="fu">fluidPage</span><span class="op">(</span></span></span>
<span class="r-in"><span> <span class="va">version_banner</span>,</span></span>
<span class="r-in"><span> <span class="co"># ... rest of UI</span></span></span>
<span class="r-in"><span><span class="op">)</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># Verbose mode for development</span></span></span>
<span class="r-in"><span><span class="va">version_banner</span> <span class="op">&lt;-</span> <span class="fu">check_app_version</span><span class="op">(</span></span></span>
<span class="r-in"><span> github_user <span class="op">=</span> <span class="st">"my-org"</span>,</span></span>
<span class="r-in"><span> github_repo <span class="op">=</span> <span class="st">"my-shiny-app"</span>,</span></span>
<span class="r-in"><span> app_version <span class="op">=</span> <span class="fu">app_version</span><span class="op">(</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> verbose <span class="op">=</span> <span class="cn">TRUE</span></span></span>
<span class="r-in"><span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span> <span class="co"># }</span></span></span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
</nav></aside></div>
<footer><div class="pkgdown-footer-left">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div>
<div class="pkgdown-footer-right">
<p>Developed by Andreas Gammelgaard Damsbo. Provided without <strong>any warranty</strong>.</p>
</div>
</footer></div>
</body></html>