Deploying to gh-pages from @ agdamsbo/REDCapCAST@80328d6e9a 🚀

This commit is contained in:
agdamsbo 2024-11-27 09:07:15 +00:00
parent ebd447297b
commit cedf90e1db
18 changed files with 442 additions and 26 deletions

View File

@ -149,7 +149,7 @@ and launch the app as follows:</p>
<span><span class="co">#&gt; $ new_event_complete_3_follow2: chr NA NA "Incomplete" "Complete" ...</span></span></code></pre></div>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">ds</span><span class="op">|&gt;</span> </span>
<span> <span class="fu"><a href="../reference/ds2dd_detailed.html">ds2dd_detailed</a></span><span class="op">(</span><span class="op">)</span><span class="op">|&gt;</span> </span>
<span> <span class="fu"><a href="../reference/ds2dd_detailed.html">ds2dd_detailed</a></span><span class="op">(</span>metadata <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="fu">REDCapCAST</span><span class="fu">::</span><span class="va"><a href="../reference/redcapcast_meta.html">redcapcast_meta</a></span><span class="op">)</span><span class="op">)</span><span class="op">|&gt;</span> </span>
<span> <span class="fu">purrr</span><span class="fu">::</span><span class="fu"><a href="https://purrr.tidyverse.org/reference/pluck.html" class="external-link">pluck</a></span><span class="op">(</span><span class="st">"data"</span><span class="op">)</span> <span class="op">|&gt;</span> </span>
<span> <span class="fu"><a href="https://rdrr.io/r/utils/str.html" class="external-link">str</a></span><span class="op">(</span><span class="op">)</span></span>
<span><span class="co">#&gt; tibble [6 × 52] (S3: tbl_df/tbl/data.frame)</span></span>
@ -207,7 +207,7 @@ and launch the app as follows:</p>
<span><span class="co">#&gt; $ new_event_complete_3_follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span></code></pre></div>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">ds</span><span class="op">|&gt;</span> </span>
<span> <span class="fu"><a href="../reference/ds2dd_detailed.html">ds2dd_detailed</a></span><span class="op">(</span><span class="op">)</span><span class="op">|&gt;</span> </span>
<span> <span class="fu"><a href="../reference/ds2dd_detailed.html">ds2dd_detailed</a></span><span class="op">(</span>metadata <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="fu">REDCapCAST</span><span class="fu">::</span><span class="va"><a href="../reference/redcapcast_meta.html">redcapcast_meta</a></span><span class="op">)</span><span class="op">)</span><span class="op">|&gt;</span> </span>
<span> <span class="fu">purrr</span><span class="fu">::</span><span class="fu"><a href="https://purrr.tidyverse.org/reference/pluck.html" class="external-link">pluck</a></span><span class="op">(</span><span class="st">"meta"</span><span class="op">)</span> <span class="op">|&gt;</span> </span>
<span> <span class="fu"><a href="https://rdrr.io/r/utils/head.html" class="external-link">head</a></span><span class="op">(</span><span class="fl">10</span><span class="op">)</span></span>
<span><span class="co">#&gt; <span style="color: #949494;"># A tibble: 10 × 18</span></span></span>

View File

@ -40,7 +40,9 @@
<div class="section level2">
<h2 class="pkg-version" data-toc-text="24.11.4" id="redcapcast-24114">REDCapCAST 24.11.4<a class="anchor" aria-label="anchor" href="#redcapcast-24114"></a></h2>
<p>The hosting on shinyapps.io has given a lot of trouble recently. Modyfied package structure a little around the <code><a href="../reference/shiny_cast.html">shiny_cast()</a></code>, to accommodate an alternative hosting approach with all package functions included in a script instead of requiring the package.</p>
<ul><li>read_readcap_labelled():</li>
<ul><li><p>NEW: A new option to <code>raw_or_label</code> in <code>read_readcap_tables()</code> has been added: “both”. Get raw values with REDCap labels applied as labels. Use <code><a href="../reference/as_factor.html">as_factor()</a></code> to format factors with original labels and use the <code>gtsummary</code> package to easily get beautiful tables with original labels from REDCap. Use <code><a href="../reference/fct_drop.html">fct_drop()</a></code> to drop empty levels.</p></li>
<li><p>NEW: fct_drop() has been added with an extension to <code><a href="https://forcats.tidyverse.org/reference/fct_drop.html" class="external-link">forcats::fct_drop()</a></code>, that works across data.frames. Use as <code><a href="../reference/fct_drop.html">fct_drop()</a></code>.</p></li>
<li><p>CHANGE: the default data export method of <code><a href="../reference/easy_redcap.html">easy_redcap()</a></code> has been changed to use the new labelled data export with <code>read_readcap_tables()</code>.</p></li>
</ul></div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="24.11.3" id="redcapcast-24113">REDCapCAST 24.11.3<a class="anchor" aria-label="anchor" href="#redcapcast-24113"></a></h2>

View File

@ -5,7 +5,7 @@ articles:
Database-creation: Database-creation.html
REDCapCAST: REDCapCAST.html
Shiny-app: Shiny-app.html
last_built: 2024-11-27T07:02Z
last_built: 2024-11-27T09:06Z
urls:
reference: https://agdamsbo.github.io/REDCapCAST/reference
article: https://agdamsbo.github.io/REDCapCAST/articles

View File

@ -0,0 +1,86 @@
<!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>Preserve all factor levels from REDCap data dictionary in data export — apply_factor_labels • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><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/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><meta property="og:title" content="Preserve all factor levels from REDCap data dictionary in data export — apply_factor_labels"><meta name="description" content="Preserve all factor levels from REDCap data dictionary in data export"><meta property="og:description" content="Preserve all factor levels from REDCap data dictionary in data export"><meta property="og:image" content="https://agdamsbo.github.io/REDCapCAST/logo.png"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
<nav class="navbar navbar-expand-lg fixed-top bg-light" data-bs-theme="light" aria-label="Site navigation"><div class="container">
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">24.11.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/REDCapCAST.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/Database-creation.html">Database-creation</a></li>
<li><a class="dropdown-item" href="../articles/Shiny-app.html">Shiny-app</a></li>
</ul></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/REDCapCAST/" 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>Preserve all factor levels from REDCap data dictionary in data export</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/read_redcap_tables.R" class="external-link"><code>R/read_redcap_tables.R</code></a></small>
<div class="d-none name"><code>apply_factor_labels.Rd</code></div>
</div>
<div class="ref-description section level2">
<p>Preserve all factor levels from REDCap data dictionary in data export</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">apply_factor_labels</span><span class="op">(</span><span class="va">data</span>, <span class="va">meta</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-data">data<a class="anchor" aria-label="anchor" href="#arg-data"></a></dt>
<dd><p>REDCap exported data set</p></dd>
<dt id="arg-meta">meta<a class="anchor" aria-label="anchor" href="#arg-meta"></a></dt>
<dd><p>REDCap data dictionary</p></dd>
</dl></div>
<div class="section level2">
<h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
<p>data.frame</p>
</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>Developed by Andreas Gammelgaard Damsbo, Paul Egeler.</p>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
</div>
</footer></div>
</body></html>

View File

@ -0,0 +1,86 @@
<!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>Apply REDCap filed labels to data frame — apply_field_label • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><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/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><meta property="og:title" content="Apply REDCap filed labels to data frame — apply_field_label"><meta name="description" content="Apply REDCap filed labels to data frame"><meta property="og:description" content="Apply REDCap filed labels to data frame"><meta property="og:image" content="https://agdamsbo.github.io/REDCapCAST/logo.png"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
<nav class="navbar navbar-expand-lg fixed-top bg-light" data-bs-theme="light" aria-label="Site navigation"><div class="container">
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">24.11.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/REDCapCAST.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/Database-creation.html">Database-creation</a></li>
<li><a class="dropdown-item" href="../articles/Shiny-app.html">Shiny-app</a></li>
</ul></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/REDCapCAST/" 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>Apply REDCap filed labels to data frame</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/read_redcap_tables.R" class="external-link"><code>R/read_redcap_tables.R</code></a></small>
<div class="d-none name"><code>apply_field_label.Rd</code></div>
</div>
<div class="ref-description section level2">
<p>Apply REDCap filed labels to data frame</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">apply_field_label</span><span class="op">(</span><span class="va">data</span>, <span class="va">meta</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-data">data<a class="anchor" aria-label="anchor" href="#arg-data"></a></dt>
<dd><p>REDCap exported data set</p></dd>
<dt id="arg-meta">meta<a class="anchor" aria-label="anchor" href="#arg-meta"></a></dt>
<dd><p>REDCap data dictionary</p></dd>
</dl></div>
<div class="section level2">
<h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
<p>data.frame</p>
</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>Developed by Andreas Gammelgaard Damsbo, Paul Egeler.</p>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
</div>
</footer></div>
</body></html>

View File

@ -0,0 +1,8 @@
<html>
<head>
<meta http-equiv="refresh" content="0;URL=https://agdamsbo.github.io/REDCapCAST/reference/as_factor.html" />
<meta name="robots" content="noindex">
<link rel="canonical" href="https://agdamsbo.github.io/REDCapCAST/reference/as_factor.html">
</head>
</html>

View File

@ -78,7 +78,18 @@ ta loss in case of rich formatted and labelled data.</p>
<span> levels <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"default"</span>, <span class="st">"labels"</span>, <span class="st">"values"</span>, <span class="st">"both"</span><span class="op">)</span>,</span>
<span> ordered <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span> <span class="va">...</span></span>
<span><span class="op">)</span></span></code></pre></div>
<span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for class 'redcapcast_labelled'</span></span>
<span><span class="fu">as_factor</span><span class="op">(</span></span>
<span> <span class="va">x</span>,</span>
<span> levels <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"default"</span>, <span class="st">"labels"</span>, <span class="st">"values"</span>, <span class="st">"both"</span><span class="op">)</span>,</span>
<span> ordered <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span> <span class="va">...</span></span>
<span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for class 'data.frame'</span></span>
<span><span class="fu">as_factor</span><span class="op">(</span><span class="va">x</span>, <span class="va">...</span>, only_labelled <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></code></pre></div>
</div>
<div class="section level2">
@ -106,6 +117,10 @@ ta loss in case of rich formatted and labelled data.</p>
<dd><p>If `TRUE` create an ordered (ordinal) factor, if
`FALSE` (the default) create a regular (nominal) factor.</p></dd>
<dt id="arg-only-labelled">only_labelled<a class="anchor" aria-label="anchor" href="#arg-only-labelled"></a></dt>
<dd><p>Only apply to labelled columns?</p></dd>
</dl></div>
<div class="section level2">
<h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>

View File

@ -0,0 +1,8 @@
<html>
<head>
<meta http-equiv="refresh" content="0;URL=https://agdamsbo.github.io/REDCapCAST/reference/as_factor.html" />
<meta name="robots" content="noindex">
<link rel="canonical" href="https://agdamsbo.github.io/REDCapCAST/reference/as_factor.html">
</head>
</html>

View File

@ -36,7 +36,7 @@ and save the first paragraph ('&amp;lt;p&amp;gt;...&amp;lt;/p&amp;gt;')."><meta
<div class="row">
<main id="main" class="col-md-9"><div class="page-header">
<img src="../logo.png" class="logo" alt=""><h1>Very simple function to remove rich text formatting from field label and save the first paragraph ('&lt;p&gt;...&lt;/p&gt;').</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/easy_redcap.R" class="external-link"><code>R/easy_redcap.R</code></a></small>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/read_redcap_tables.R" class="external-link"><code>R/read_redcap_tables.R</code></a></small>
<div class="d-none name"><code>clean_field_label.Rd</code></div>
</div>

View File

@ -54,7 +54,7 @@ for a more advanced function.</p>
<span> field.type <span class="op">=</span> <span class="st">"text"</span>,</span>
<span> field.label <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span> include.column.names <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span> metadata <span class="op">=</span> <span class="fu">REDCapCAST</span><span class="fu">::</span><span class="fu"><a href="redcap_meta_default.html">redcap_meta_default</a></span><span class="op">(</span><span class="op">)</span></span>
<span> metadata <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="fu">REDCapCAST</span><span class="fu">::</span><span class="va"><a href="redcapcast_meta.html">redcapcast_meta</a></span><span class="op">)</span></span>
<span><span class="op">)</span></span></code></pre></div>
</div>
@ -94,7 +94,7 @@ column names for original data set for upload.</p></dd>
<dt id="arg-metadata">metadata<a class="anchor" aria-label="anchor" href="#arg-metadata"></a></dt>
<dd><p>Metadata column names. Default is the included
REDCapCAST::redcap_meta_default.</p></dd>
names(REDCapCAST::redcapcast_meta).</p></dd>
</dl></div>
<div class="section level2">

View File

@ -55,7 +55,7 @@
<span> field.label <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span> field.label.attr <span class="op">=</span> <span class="st">"label"</span>,</span>
<span> field.validation <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span> metadata <span class="op">=</span> <span class="fu">REDCapCAST</span><span class="fu">::</span><span class="fu"><a href="redcap_meta_default.html">redcap_meta_default</a></span><span class="op">(</span><span class="op">)</span>,</span>
<span> metadata <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="fu">REDCapCAST</span><span class="fu">::</span><span class="va"><a href="redcapcast_meta.html">redcapcast_meta</a></span><span class="op">)</span>,</span>
<span> convert.logicals <span class="op">=</span> <span class="cn">TRUE</span></span>
<span><span class="op">)</span></span></code></pre></div>
</div>
@ -120,7 +120,7 @@ file with `haven::read_dta()`).</p></dd>
<dt id="arg-metadata">metadata<a class="anchor" aria-label="anchor" href="#arg-metadata"></a></dt>
<dd><p>redcap metadata headings. Default is
REDCapCAST::redcap_meta_default().</p></dd>
names(REDCapCAST::redcapcast_meta).</p></dd>
<dt id="arg-convert-logicals">convert.logicals<a class="anchor" aria-label="anchor" href="#arg-convert-logicals"></a></dt>

View File

@ -0,0 +1,8 @@
<html>
<head>
<meta http-equiv="refresh" content="0;URL=https://agdamsbo.github.io/REDCapCAST/reference/fct_drop.html" />
<meta name="robots" content="noindex">
<link rel="canonical" href="https://agdamsbo.github.io/REDCapCAST/reference/fct_drop.html">
</head>
</html>

85
reference/fct_drop.html Normal file
View File

@ -0,0 +1,85 @@
<!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>Drop unused levels preserving label data — fct_drop • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><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/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><meta property="og:title" content="Drop unused levels preserving label data — fct_drop"><meta name="description" content="This extends [forcats::fct_drop()] to natively work across a data.frame and
replace [base::droplevels()]."><meta property="og:description" content="This extends [forcats::fct_drop()] to natively work across a data.frame and
replace [base::droplevels()]."><meta property="og:image" content="https://agdamsbo.github.io/REDCapCAST/logo.png"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
<nav class="navbar navbar-expand-lg fixed-top bg-light" data-bs-theme="light" aria-label="Site navigation"><div class="container">
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">24.11.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/REDCapCAST.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/Database-creation.html">Database-creation</a></li>
<li><a class="dropdown-item" href="../articles/Shiny-app.html">Shiny-app</a></li>
</ul></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/REDCapCAST/" 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>Drop unused levels preserving label data</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/fct_drop.R" class="external-link"><code>R/fct_drop.R</code></a></small>
<div class="d-none name"><code>fct_drop.Rd</code></div>
</div>
<div class="ref-description section level2">
<p>This extends [forcats::fct_drop()] to natively work across a data.frame and
replace [base::droplevels()].</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">fct_drop.data.frame</span><span class="op">(</span><span class="va">x</span>, <span class="va">...</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-x">x<a class="anchor" aria-label="anchor" href="#arg-x"></a></dt>
<dd><p>Factor to drop unused levels</p></dd>
<dt id="arg--">...<a class="anchor" aria-label="anchor" href="#arg--"></a></dt>
<dd><p>Other arguments passed down to method.</p></dd>
</dl></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>Developed by Andreas Gammelgaard Damsbo, Paul Egeler.</p>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
</div>
</footer></div>
</body></html>

View File

@ -61,6 +61,18 @@
<dd>Check if vector is all NA</dd>
</dl><dl><dt>
<code><a href="apply_factor_labels.html">apply_factor_labels()</a></code>
</dt>
<dd>Preserve all factor levels from REDCap data dictionary in data export</dd>
</dl><dl><dt>
<code><a href="apply_field_label.html">apply_field_label()</a></code>
</dt>
<dd>Apply REDCap filed labels to data frame</dd>
</dl><dl><dt>
<code><a href="as_factor.html">as_factor()</a></code>
</dt>
@ -169,6 +181,12 @@
<dd>Allows conversion of factor to numeric values preserving original levels</dd>
</dl><dl><dt>
<code><a href="fct_drop.html">fct_drop.data.frame()</a></code>
</dt>
<dd>Drop unused levels preserving label data</dd>
</dl><dl><dt>
<code><a href="file_extension.html">file_extension()</a></code>
</dt>
@ -235,6 +253,12 @@
<dd>Simple html tag wrapping for REDCap text formatting</dd>
</dl><dl><dt>
<code><a href="is.labelled.html">is.labelled()</a></code>
</dt>
<dd>Tests for multiple label classes</dd>
</dl><dl><dt>
<code><a href="is_missing.html">is_missing()</a></code>
</dt>
@ -337,24 +361,12 @@
<dd>Convenience function to download complete instrument, using token storage in keyring.</dd>
</dl><dl><dt>
<code><a href="read_redcap_labelled.html">read_redcap_labelled()</a></code>
</dt>
<dd>REDCap read function to preserve field labels and all factor levels</dd>
</dl><dl><dt>
<code><a href="read_redcap_tables.html">read_redcap_tables()</a></code>
</dt>
<dd>Download REDCap data</dd>
</dl><dl><dt>
<code><a href="redcap_meta_default.html">redcap_meta_default()</a></code>
</dt>
<dd>Default column names of a REDCap data dictionary</dd>
</dl><dl><dt>
<code><a href="redcap_wider.html">redcap_wider()</a></code>
</dt>

View File

@ -0,0 +1,98 @@
<!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>Tests for multiple label classes — is.labelled • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><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/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><meta property="og:title" content="Tests for multiple label classes — is.labelled"><meta name="description" content="Tests for multiple label classes"><meta property="og:description" content="Tests for multiple label classes"><meta property="og:image" content="https://agdamsbo.github.io/REDCapCAST/logo.png"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
<nav class="navbar navbar-expand-lg fixed-top bg-light" data-bs-theme="light" aria-label="Site navigation"><div class="container">
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">24.11.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/REDCapCAST.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/Database-creation.html">Database-creation</a></li>
<li><a class="dropdown-item" href="../articles/Shiny-app.html">Shiny-app</a></li>
</ul></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/REDCapCAST/" 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>Tests for multiple label classes</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/as_factor.R" class="external-link"><code>R/as_factor.R</code></a></small>
<div class="d-none name"><code>is.labelled.Rd</code></div>
</div>
<div class="ref-description section level2">
<p>Tests for multiple label classes</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">is.labelled</span><span class="op">(</span></span>
<span> <span class="va">x</span>,</span>
<span> classes <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"redcapcast_labelled"</span>, <span class="st">"haven_labelled"</span>, <span class="st">"labelled"</span><span class="op">)</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-x">x<a class="anchor" aria-label="anchor" href="#arg-x"></a></dt>
<dd><p>data</p></dd>
<dt id="arg-classes">classes<a class="anchor" aria-label="anchor" href="#arg-classes"></a></dt>
<dd><p>classes to test</p></dd>
</dl></div>
<div class="section level2">
<h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
<p>logical</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="fu"><a href="https://rdrr.io/r/base/structure.html" class="external-link">structure</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">1</span>, <span class="fl">2</span>, <span class="fl">3</span>, <span class="fl">2</span>, <span class="fl">10</span>, <span class="fl">9</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> labels <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span>Unknown <span class="op">=</span> <span class="fl">9</span>, Refused <span class="op">=</span> <span class="fl">10</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> class <span class="op">=</span> <span class="st">"haven_labelled"</span></span></span>
<span class="r-in"><span><span class="op">)</span> <span class="op">|&gt;</span> <span class="fu">is.labelled</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] TRUE</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>Developed by Andreas Gammelgaard Damsbo, Paul Egeler.</p>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
</div>
</footer></div>
</body></html>

View File

@ -97,7 +97,13 @@ instruments.</p>
<dt id="arg-raw-or-label">raw_or_label<a class="anchor" aria-label="anchor" href="#arg-raw-or-label"></a></dt>
<dd><p>raw or label tags</p></dd>
<dd><p>raw or label tags. Can be</p>
<p>* "raw": Standard [REDCapR] method to get raw values.
* "label": Standard [REDCapR] method to get label values.
* "both": Get raw values with REDCap labels applied as labels. Use
[as_factor()] to format factors with original labels and use the
[gtsummary] package to easily get beautiful tables with original labels
from REDCap. Use [fct_drop()] to drop empty levels.</p></dd>
<dt id="arg-split-forms">split_forms<a class="anchor" aria-label="anchor" href="#arg-split-forms"></a></dt>

File diff suppressed because one or more lines are too long

View File

@ -12,6 +12,8 @@
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/REDCapCAST-package.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/REDCap_split.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/all_na.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/apply_factor_labels.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/apply_field_label.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/as_factor.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/case_match_regex_list.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/cast_data_overview.html</loc></url>
@ -30,6 +32,7 @@
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/easy_redcap.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/export_redcap_instrument.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/fct2num.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/fct_drop.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/file_extension.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/focused_metadata.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/format_subheader.html</loc></url>
@ -42,6 +45,7 @@
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/hms2character.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/html_tag_wrap.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/index.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/is.labelled.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/is_missing.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/is_repeated_longitudinal.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/mark_complete.html</loc></url>
@ -59,9 +63,7 @@
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/process_user_input.response.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/read_input.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_instrument.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_labelled.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_tables.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/redcap_meta_default.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/redcap_wider.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/redcapcast_data.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/redcapcast_meta.html</loc></url>