Compare commits

..

No commits in common. "220a333a7b63737c418e24d9bbad94a27133bad0" and "ffec8f645aea966e0818d0048b5ab8221e128f3b" have entirely different histories.

26 changed files with 316 additions and 757 deletions

View File

@ -344,12 +344,6 @@ based on a set threshold for unique values:</p>
<code class="sourceCode R"><span><span class="va">ds_parsed</span><span class="op">|&gt;</span></span>
<span> <span class="fu"><a href="../reference/numchar2fct.html">numchar2fct</a></span><span class="op">(</span>numeric.threshold <span class="op">=</span> <span class="fl">2</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; Warning: There were 13 warnings in `dplyr::mutate()`.</span></span>
<span><span class="co">#&gt; The first warning was:</span></span>
<span><span class="co">#&gt; <span style="color: #00BBBB;"></span> In argument: `dplyr::across(...)`.</span></span>
<span><span class="co">#&gt; Caused by warning in `.roman2numeric()`:</span></span>
<span><span class="co">#&gt; <span style="color: #BBBB00;">!</span> invalid roman numerals: inclusion inclusion follow1 follow1 inclusion follow1 follow2 follow1 follow1 follow2 follow2 follow2 inclusion follow1 follow2 follow1 follow1 follow2 follow2 follow2 inclusion follow1 follow1 follow1 inclusion</span></span>
<span><span class="co">#&gt; <span style="color: #00BBBB;"></span> Run `dplyr::last_dplyr_warnings()` to see the 12 remaining warnings.</span></span>
<span><span class="co">#&gt; tibble [25 × 27] (S3: tbl_df/tbl/data.frame)</span></span>
<span><span class="co">#&gt; $ record_id : num [1:25] 1 2 2 2 3 3 3 3 3 3 ...</span></span>
<span><span class="co">#&gt; $ redcap_event_name : Factor w/ 3 levels "inclusion","follow1",..: 1 1 2 2 1 2 3 2 2 3 ...</span></span>

View File

@ -5,7 +5,7 @@ articles:
Database-creation: Database-creation.html
REDCapCAST: REDCapCAST.html
Shiny-app: Shiny-app.html
last_built: 2024-11-20T15:36Z
last_built: 2024-11-19T12:19Z
urls:
reference: https://agdamsbo.github.io/REDCapCAST/reference
article: https://agdamsbo.github.io/REDCapCAST/articles

View File

@ -62,8 +62,7 @@ Casting metadata for REDCap database creation and handling of castellated data u
<div class="section level2">
<h2 id="author">Author<a class="anchor" aria-label="anchor" href="#author"></a></h2>
<p><strong>Maintainer</strong>: Andreas Gammelgaard Damsbo <a href="mailto:agdamsbo@clin.au.dk">agdamsbo@clin.au.dk</a> (<a href="https://orcid.org/0000-0002-7559-1154" class="external-link">ORCID</a>)</p>
<p>Authors:</p><ul><li><p>Paul Egeler <a href="mailto:paulegeler@gmail.com">paulegeler@gmail.com</a> (<a href="https://orcid.org/0000-0001-6948-9498" class="external-link">ORCID</a>)</p></li>
</ul></div>
</div>
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
</nav></aside></div>

View File

@ -1,8 +0,0 @@
<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

@ -1,8 +0,0 @@
<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

@ -1,8 +0,0 @@
<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

@ -1,162 +0,0 @@
<!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>Convert labelled vectors to factors while preserving attributes — as_factor • 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="Convert labelled vectors to factors while preserving attributes — as_factor"><meta name="description" content='This extends [forcats::as_factor()] as well as [haven::as_factor()], by appending
original attributes except for "class" after converting to factor to avoid
ta loss in case of rich formatted and labelled data.'><meta property="og:description" content='This extends [forcats::as_factor()] as well as [haven::as_factor()], by appending
original attributes except for "class" after converting to factor to avoid
ta loss in case of rich formatted and labelled data.'><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.2</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>Convert labelled vectors to factors while preserving attributes</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>as_factor.Rd</code></div>
</div>
<div class="ref-description section level2">
<p>This extends [forcats::as_factor()] as well as [haven::as_factor()], by appending
original attributes except for "class" after converting to factor to avoid
ta loss in case of rich formatted and labelled data.</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">as_factor</span><span class="op">(</span><span class="va">x</span>, <span class="va">...</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for class 'factor'</span></span>
<span><span class="fu">as_factor</span><span class="op">(</span><span class="va">x</span>, <span class="va">...</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for class 'logical'</span></span>
<span><span class="fu">as_factor</span><span class="op">(</span><span class="va">x</span>, <span class="va">...</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for class 'numeric'</span></span>
<span><span class="fu">as_factor</span><span class="op">(</span><span class="va">x</span>, <span class="va">...</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for class 'character'</span></span>
<span><span class="fu">as_factor</span><span class="op">(</span><span class="va">x</span>, <span class="va">...</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for class 'haven_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 '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></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>Object to coerce to a factor.</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>
<dt id="arg-levels">levels<a class="anchor" aria-label="anchor" href="#arg-levels"></a></dt>
<dd><p>How to create the levels of the generated factor:</p>
<p>* "default": uses labels where available, otherwise the values.
Labels are sorted by value.
* "both": like "default", but pastes together the level and value
* "label": use only the labels; unlabelled values become `NA`
* "values": use only the values</p></dd>
<dt id="arg-ordered">ordered<a class="anchor" aria-label="anchor" href="#arg-ordered"></a></dt>
<dd><p>If `TRUE` create an ordered (ordinal) factor, if
`FALSE` (the default) create a regular (nominal) factor.</p></dd>
</dl></div>
<div class="section level2">
<h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
<p>Please refer to parent functions for extended documentation.
To avoid redundancy calls and errors, functions are copy-pasted here</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="co"># will preserve all attributes</span></span></span>
<span class="r-in"><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">4</span>, <span class="fl">3</span>, <span class="st">"A"</span>, <span class="fl">7</span>, <span class="fl">8</span>, <span class="fl">1</span><span class="op">)</span> <span class="op">|&gt;</span> <span class="fu">as_factor</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span class="warning">Warning: </span>invalid roman numeral: A</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1 4 3 A 7 8 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Levels: 1 4 3 A 7 8</span>
<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><span class="op">)</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu">as_factor</span><span class="op">(</span><span class="op">)</span> <span class="op">|&gt;</span> <span class="fu"><a href="https://rdrr.io/r/base/dput.html" class="external-link">dput</a></span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> structure(c(1L, 2L, 3L, 2L, 5L, 4L), levels = c("1", "2", "3", </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> "9", "10"), class = "factor", labels = c(Unknown = 9, Refused = 10</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> ))</span>
<span class="r-in"><span></span></span>
<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></span>
<span class="r-in"><span> <span class="fu">as_factor</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1 2 3 2 Refused Unknown</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> attr(,"labels")</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Unknown Refused </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 10 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Levels: 1 2 3 Unknown Refused</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

@ -1,8 +0,0 @@
<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

@ -1,8 +0,0 @@
<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

@ -1,8 +0,0 @@
<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

@ -1,82 +0,0 @@
<!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>Overview of REDCapCAST data for shiny — cast_data_overview • 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="Overview of REDCapCAST data for shiny — cast_data_overview"><meta name="description" content="Overview of REDCapCAST data for shiny"><meta property="og:description" content="Overview of REDCapCAST data for shiny"><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.2</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>Overview of REDCapCAST data for shiny</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/shiny_cast.R" class="external-link"><code>R/shiny_cast.R</code></a></small>
<div class="d-none name"><code>cast_data_overview.Rd</code></div>
</div>
<div class="ref-description section level2">
<p>Overview of REDCapCAST data for shiny</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">cast_data_overview</span><span class="op">(</span><span class="va">data</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>list with class 'REDCapCAST'</p></dd>
</dl></div>
<div class="section level2">
<h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
<p>gt object</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

@ -1,82 +0,0 @@
<!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>Overview of REDCapCAST meta data for shiny — cast_meta_overview • 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="Overview of REDCapCAST meta data for shiny — cast_meta_overview"><meta name="description" content="Overview of REDCapCAST meta data for shiny"><meta property="og:description" content="Overview of REDCapCAST meta data for shiny"><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.2</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>Overview of REDCapCAST meta data for shiny</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/shiny_cast.R" class="external-link"><code>R/shiny_cast.R</code></a></small>
<div class="d-none name"><code>cast_meta_overview.Rd</code></div>
</div>
<div class="ref-description section level2">
<p>Overview of REDCapCAST meta data for shiny</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">cast_meta_overview</span><span class="op">(</span><span class="va">data</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>list with class 'REDCapCAST'</p></dd>
</dl></div>
<div class="section level2">
<h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
<p>gt object</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

@ -133,8 +133,6 @@ Default is TRUE.</p></dd>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># question_number &lt;lgl&gt;, matrix_group_name &lt;lgl&gt;, matrix_ranking &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># field_annotation &lt;lgl&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> attr(,"class")</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] "REDCapCAST" "list" </span>
<span class="r-in"><span><span class="co"># data |&gt;</span></span></span>
<span class="r-in"><span><span class="co"># purrr::pluck("meta") |&gt;</span></span></span>
<span class="r-in"><span><span class="co"># create_instrument_meta(record.id = FALSE)</span></span></span>

View File

@ -142,24 +142,190 @@ Please, do always inspect the data dictionary before upload.</p>
<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="va">data</span> <span class="op">&lt;-</span> <span class="fu">REDCapCAST</span><span class="fu">::</span><span class="va"><a href="redcapcast_data.html">redcapcast_data</a></span></span></span>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="va">data</span> <span class="op">&lt;-</span> <span class="fu">REDCapCAST</span><span class="fu">::</span><span class="va"><a href="redcapcast_data.html">redcapcast_data</a></span></span></span>
<span class="r-in"><span><span class="va">data</span> <span class="op">|&gt;</span> <span class="fu">ds2dd_detailed</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $data</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 25 × 27</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> record_id redcap_event_name redcap_repeat_instrument redcap_repeat_instance</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> 1 inclusion <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 2 inclusion <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 2 follow1 <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 2 follow1 New Event (?) 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 3 inclusion <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 3 follow1 <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 3 follow2 <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 3 follow1 New Event (?) 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 3 follow1 New Event (?) 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 3 follow2 New Event (?) 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 15 more rows</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 23 more variables: cpr &lt;chr&gt;, inclusion &lt;date&gt;, inclusion_time &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># dob &lt;date&gt;, age &lt;dbl&gt;, age_integer &lt;dbl&gt;, sex &lt;chr&gt;, cohabitation &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># hypertension &lt;chr&gt;, diabetes &lt;chr&gt;, region &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># baseline_data_start_complete &lt;chr&gt;, mrs_assessed &lt;chr&gt;, mrs_date &lt;date&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># mrs_score &lt;dbl&gt;, mrs_complete &lt;chr&gt;, con_mrs &lt;fct&gt;, con_calc &lt;fct&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># consensus_complete &lt;chr&gt;, event_datetime &lt;dttm&gt;, event_age &lt;dbl&gt;, …</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $meta</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 27 × 18</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> field_name form_name section_header field_type field_label </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;lgl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> record_id data <span style="color: #BB0000;">NA</span> text record_id </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> redcap_event_name data <span style="color: #BB0000;">NA</span> text redcap_event_na…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> redcap_repeat_instrument data <span style="color: #BB0000;">NA</span> text redcap_repeat_i…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> redcap_repeat_instance data <span style="color: #BB0000;">NA</span> text redcap_repeat_i…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> cpr data <span style="color: #BB0000;">NA</span> text cpr </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> inclusion data <span style="color: #BB0000;">NA</span> text inclusion </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> inclusion_time data <span style="color: #BB0000;">NA</span> text inclusion_time </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> dob data <span style="color: #BB0000;">NA</span> text dob </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> age data <span style="color: #BB0000;">NA</span> text age </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> age_integer data <span style="color: #BB0000;">NA</span> text age_integer </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 17 more rows</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 13 more variables: select_choices_or_calculations &lt;chr&gt;, field_note &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># text_validation_type_or_show_slider_number &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># text_validation_min &lt;lgl&gt;, text_validation_max &lt;lgl&gt;, identifier &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># branching_logic &lt;lgl&gt;, required_field &lt;lgl&gt;, custom_alignment &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># question_number &lt;lgl&gt;, matrix_group_name &lt;lgl&gt;, matrix_ranking &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># field_annotation &lt;lgl&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-in"><span><span class="va">iris</span> <span class="op">|&gt;</span> <span class="fu">ds2dd_detailed</span><span class="op">(</span>add.auto.id <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> A default id column has been added</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $data</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 150 × 6</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> record_id sepal.length sepal.width petal.length petal.width species</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;int&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;fct&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> 1 5.1 3.5 1.4 0.2 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 2 4.9 3 1.4 0.2 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 3 4.7 3.2 1.3 0.2 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 4 4.6 3.1 1.5 0.2 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 5 5 3.6 1.4 0.2 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 6 5.4 3.9 1.7 0.4 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 7 4.6 3.4 1.4 0.3 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 8 5 3.4 1.5 0.2 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 9 4.4 2.9 1.4 0.2 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 10 4.9 3.1 1.5 0.1 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 140 more rows</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $meta</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 6 × 18</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> field_name form_name section_header field_type field_label </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;lgl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> record_id data <span style="color: #BB0000;">NA</span> text record_id </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> sepal.length data <span style="color: #BB0000;">NA</span> text sepal.length</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> sepal.width data <span style="color: #BB0000;">NA</span> text sepal.width </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">4</span> petal.length data <span style="color: #BB0000;">NA</span> text petal.length</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">5</span> petal.width data <span style="color: #BB0000;">NA</span> text petal.width </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">6</span> species data <span style="color: #BB0000;">NA</span> radio species </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 13 more variables: select_choices_or_calculations &lt;chr&gt;, field_note &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># text_validation_type_or_show_slider_number &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># text_validation_min &lt;lgl&gt;, text_validation_max &lt;lgl&gt;, identifier &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># branching_logic &lt;lgl&gt;, required_field &lt;lgl&gt;, custom_alignment &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># question_number &lt;lgl&gt;, matrix_group_name &lt;lgl&gt;, matrix_ranking &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># field_annotation &lt;lgl&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-in"><span><span class="va">iris</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu">ds2dd_detailed</span><span class="op">(</span></span></span>
<span class="r-in"><span> add.auto.id <span class="op">=</span> <span class="cn">TRUE</span>,</span></span>
<span class="r-in"><span> form.name <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/sample.html" class="external-link">sample</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="st">"b"</span>, <span class="st">"c"</span><span class="op">)</span>, size <span class="op">=</span> <span class="fl">6</span>, replace <span class="op">=</span> <span class="cn">TRUE</span>, prob <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/rep.html" class="external-link">rep</a></span><span class="op">(</span><span class="fl">.5</span>, <span class="fl">2</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="op">)</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><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></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> A default id column has been added</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 6 × 18</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> field_name form_name section_header field_type field_label </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;lgl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> record_id c <span style="color: #BB0000;">NA</span> text record_id </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> sepal.length b <span style="color: #BB0000;">NA</span> text sepal.length</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> sepal.width b <span style="color: #BB0000;">NA</span> text sepal.width </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">4</span> petal.length b <span style="color: #BB0000;">NA</span> text petal.length</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">5</span> petal.width c <span style="color: #BB0000;">NA</span> text petal.width </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">6</span> species c <span style="color: #BB0000;">NA</span> radio species </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 13 more variables: select_choices_or_calculations &lt;chr&gt;, field_note &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># text_validation_type_or_show_slider_number &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># text_validation_min &lt;lgl&gt;, text_validation_max &lt;lgl&gt;, identifier &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># branching_logic &lt;lgl&gt;, required_field &lt;lgl&gt;, custom_alignment &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># question_number &lt;lgl&gt;, matrix_group_name &lt;lgl&gt;, matrix_ranking &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># field_annotation &lt;lgl&gt;</span></span>
<span class="r-in"><span><span class="va">mtcars</span> <span class="op">|&gt;</span> <span class="fu">ds2dd_detailed</span><span class="op">(</span>add.auto.id <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> A default id column has been added</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $data</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 32 × 12</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> record_id mpg cyl disp hp drat wt qsec vs am gear carb</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;int&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 22 more rows</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $meta</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 12 × 18</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> field_name form_name section_header field_type field_label</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;lgl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> record_id data <span style="color: #BB0000;">NA</span> text record_id </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> mpg data <span style="color: #BB0000;">NA</span> text mpg </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> cyl data <span style="color: #BB0000;">NA</span> text cyl </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> disp data <span style="color: #BB0000;">NA</span> text disp </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> hp data <span style="color: #BB0000;">NA</span> text hp </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> drat data <span style="color: #BB0000;">NA</span> text drat </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> wt data <span style="color: #BB0000;">NA</span> text wt </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> qsec data <span style="color: #BB0000;">NA</span> text qsec </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> vs data <span style="color: #BB0000;">NA</span> text vs </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> am data <span style="color: #BB0000;">NA</span> text am </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">11</span> gear data <span style="color: #BB0000;">NA</span> text gear </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">12</span> carb data <span style="color: #BB0000;">NA</span> text carb </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 13 more variables: select_choices_or_calculations &lt;lgl&gt;, field_note &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># text_validation_type_or_show_slider_number &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># text_validation_min &lt;lgl&gt;, text_validation_max &lt;lgl&gt;, identifier &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># branching_logic &lt;lgl&gt;, required_field &lt;lgl&gt;, custom_alignment &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># question_number &lt;lgl&gt;, matrix_group_name &lt;lgl&gt;, matrix_ranking &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># field_annotation &lt;lgl&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-in"><span><span class="va">data</span> <span class="op">&lt;-</span> <span class="va">iris</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu">ds2dd_detailed</span><span class="op">(</span>add.auto.id <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><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></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> A default id column has been added</span>
<span class="r-in"><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="va">data</span><span class="op">)</span> <span class="op">&lt;-</span> <span class="fu">glue</span><span class="fu">::</span><span class="fu"><a href="https://glue.tidyverse.org/reference/glue.html" class="external-link">glue</a></span><span class="op">(</span><span class="st">"{sample(x = c('a','b'),size = length(names(data)),</span></span></span>
<span class="r-in"><span><span class="st">replace=TRUE,prob = rep(x=.5,2))}__{names(data)}"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">data</span> <span class="op">|&gt;</span> <span class="fu">ds2dd_detailed</span><span class="op">(</span>form.sep <span class="op">=</span> <span class="st">"__"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span> <span class="co"># }</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $data</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 150 × 6</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> record_id sepal.length sepal.width petal.length petal.width species</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;int&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;fct&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> 1 5.1 3.5 1.4 0.2 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 2 4.9 3 1.4 0.2 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 3 4.7 3.2 1.3 0.2 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 4 4.6 3.1 1.5 0.2 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 5 5 3.6 1.4 0.2 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 6 5.4 3.9 1.7 0.4 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 7 4.6 3.4 1.4 0.3 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 8 5 3.4 1.5 0.2 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 9 4.4 2.9 1.4 0.2 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 10 4.9 3.1 1.5 0.1 setosa </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 140 more rows</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $meta</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 6 × 18</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> field_name form_name section_header field_type field_label </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;lgl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> record_id b <span style="color: #BB0000;">NA</span> text record_id </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> sepal.length b <span style="color: #BB0000;">NA</span> text sepal.length</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> sepal.width b <span style="color: #BB0000;">NA</span> text sepal.width </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">4</span> petal.length b <span style="color: #BB0000;">NA</span> text petal.length</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">5</span> petal.width b <span style="color: #BB0000;">NA</span> text petal.width </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">6</span> species b <span style="color: #BB0000;">NA</span> radio species </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 13 more variables: select_choices_or_calculations &lt;chr&gt;, field_note &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># text_validation_type_or_show_slider_number &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># text_validation_min &lt;lgl&gt;, text_validation_max &lt;lgl&gt;, identifier &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># branching_logic &lt;lgl&gt;, required_field &lt;lgl&gt;, custom_alignment &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># question_number &lt;lgl&gt;, matrix_group_name &lt;lgl&gt;, matrix_ranking &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># field_annotation &lt;lgl&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</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>

View File

@ -1,125 +0,0 @@
<!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>Allows conversion of factor to numeric values preserving original levels — fct2num • 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="Allows conversion of factor to numeric values preserving original levels — fct2num"><meta name="description" content="Allows conversion of factor to numeric values preserving original levels"><meta property="og:description" content="Allows conversion of factor to numeric values preserving original levels"><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.2</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>Allows conversion of factor to numeric values preserving original levels</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>fct2num.Rd</code></div>
</div>
<div class="ref-description section level2">
<p>Allows conversion of factor to numeric values preserving original levels</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">fct2num</span><span class="op">(</span><span class="va">data</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>vector</p></dd>
</dl></div>
<div class="section level2">
<h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
<p>numeric vector</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/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">1</span>, <span class="fl">4</span>, <span class="fl">3</span>, <span class="st">"A"</span>, <span class="fl">7</span>, <span class="fl">8</span>, <span class="fl">1</span><span class="op">)</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="as_factor.html">as_factor</a></span><span class="op">(</span><span class="op">)</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu">fct2num</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span class="warning">Warning: </span>invalid roman numeral: A</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1 2 3 4 5 6 1</span>
<span class="r-in"><span></span></span>
<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></span>
<span class="r-in"><span> <span class="fu"><a href="as_factor.html">as_factor</a></span><span class="op">(</span><span class="op">)</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu">fct2num</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1 2 3 2 10 9</span>
<span class="r-in"><span></span></span>
<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">"labelled"</span></span></span>
<span class="r-in"><span><span class="op">)</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="as_factor.html">as_factor</a></span><span class="op">(</span><span class="op">)</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu">fct2num</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1 2 3 2 10 9</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># Outlier with labels, but no class of origin, handled like numeric vector</span></span></span>
<span class="r-in"><span><span class="co"># structure(c(1, 2, 3, 2, 10, 9),</span></span></span>
<span class="r-in"><span><span class="co"># labels = c(Unknown = 9, Refused = 10)</span></span></span>
<span class="r-in"><span><span class="co"># ) |&gt;</span></span></span>
<span class="r-in"><span><span class="co"># as_factor() |&gt;</span></span></span>
<span class="r-in"><span><span class="co"># fct2num()</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">v</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/sample.html" class="external-link">sample</a></span><span class="op">(</span><span class="fl">6</span><span class="op">:</span><span class="fl">19</span>,<span class="fl">20</span>,<span class="cn">TRUE</span><span class="op">)</span> <span class="op">|&gt;</span> <span class="fu"><a href="https://rdrr.io/r/base/factor.html" class="external-link">factor</a></span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/dput.html" class="external-link">dput</a></span><span class="op">(</span><span class="va">v</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> structure(c(2L, 4L, 7L, 3L, 3L, 6L, 10L, 1L, 11L, 5L, 8L, 11L, </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8L, 3L, 3L, 9L, 10L, 1L, 4L, 2L), levels = c("7", "9", "10", </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> "11", "12", "13", "14", "16", "17", "18", "19"), class = "factor")</span>
<span class="r-in"><span><span class="fu"><a href="named_levels.html">named_levels</a></span><span class="op">(</span><span class="va">v</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 11 14 10 13 18 7 19 12 16 17 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 4 7 3 6 10 1 11 5 8 9 </span>
<span class="r-in"><span><span class="fu">fct2num</span><span class="op">(</span><span class="va">v</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 9 11 14 10 10 13 18 7 19 12 16 19 16 10 10 17 18 7 11 9</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

@ -34,7 +34,7 @@
<div class="row">
<main id="main" class="col-md-9"><div class="page-header">
<img src="../logo.png" class="logo" alt=""><h1>Extract attribute. Returns NA if none</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>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/ds2dd_detailed.R" class="external-link"><code>R/ds2dd_detailed.R</code></a></small>
<div class="d-none name"><code>get_attr.Rd</code></div>
</div>
@ -67,15 +67,119 @@
<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/attr.html" class="external-link">attr</a></span><span class="op">(</span><span class="va">mtcars</span><span class="op">$</span><span class="va">mpg</span>, <span class="st">"label"</span><span class="op">)</span> <span class="op">&lt;-</span> <span class="st">"testing"</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/do.call.html" class="external-link">do.call</a></span><span class="op">(</span><span class="va">c</span>, <span class="fu"><a href="https://rdrr.io/r/base/lapply.html" class="external-link">sapply</a></span><span class="op">(</span><span class="va">mtcars</span>, <span class="va">get_attr</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $mpg.label</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/lapply.html" class="external-link">sapply</a></span><span class="op">(</span><span class="va">mtcars</span>, <span class="va">get_attr</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $mpg</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $mpg$label</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] "testing"</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<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-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $cyl</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $disp</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $hp</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $drat</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $wt</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $qsec</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $vs</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $am</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $gear</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $carb</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/lapply.html" class="external-link">lapply</a></span><span class="op">(</span><span class="va">mtcars</span>, \<span class="op">(</span><span class="va">.x</span><span class="op">)</span><span class="fu">get_attr</span><span class="op">(</span><span class="va">.x</span>, <span class="cn">NULL</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $mpg</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $mpg$label</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] "testing"</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $cyl</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $disp</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $hp</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $drat</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $wt</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $qsec</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $vs</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $am</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $gear</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $carb</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> NULL</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-in"><span><span class="va">mtcars</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="numchar2fct.html">numchar2fct</a></span><span class="op">(</span>numeric.threshold <span class="op">=</span> <span class="fl">6</span><span class="op">)</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="ds2dd_detailed.html">ds2dd_detailed</a></span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span> <span class="co"># }</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $data</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 32 × 11</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> mpg cyl disp hp drat wt qsec vs am gear carb </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;fct&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;fct&gt;</span> <span style="color: #949494; font-style: italic;">&lt;fct&gt;</span> <span style="color: #949494; font-style: italic;">&lt;fct&gt;</span> <span style="color: #949494; font-style: italic;">&lt;fct&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> 21 6 160 110 3.9 2.62 16.5 0 1 4 4 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 21 6 160 110 3.9 2.88 17.0 0 1 4 4 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 22 more rows</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $meta</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 11 × 18</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> field_name form_name section_header field_type field_label</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;lgl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> mpg data <span style="color: #BB0000;">NA</span> text testing </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> cyl data <span style="color: #BB0000;">NA</span> radio cyl </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> disp data <span style="color: #BB0000;">NA</span> text disp </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> hp data <span style="color: #BB0000;">NA</span> text hp </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> drat data <span style="color: #BB0000;">NA</span> text drat </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> wt data <span style="color: #BB0000;">NA</span> text wt </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> qsec data <span style="color: #BB0000;">NA</span> text qsec </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> vs data <span style="color: #BB0000;">NA</span> radio vs </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> am data <span style="color: #BB0000;">NA</span> radio am </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> gear data <span style="color: #BB0000;">NA</span> radio gear </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">11</span> carb data <span style="color: #BB0000;">NA</span> radio carb </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 13 more variables: select_choices_or_calculations &lt;chr&gt;, field_note &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># text_validation_type_or_show_slider_number &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># text_validation_min &lt;lgl&gt;, text_validation_max &lt;lgl&gt;, identifier &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># branching_logic &lt;lgl&gt;, required_field &lt;lgl&gt;, custom_alignment &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># question_number &lt;lgl&gt;, matrix_group_name &lt;lgl&gt;, matrix_ranking &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># field_annotation &lt;lgl&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</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>

View File

@ -34,7 +34,7 @@
<div class="row">
<main id="main" class="col-md-9"><div class="page-header">
<img src="../logo.png" class="logo" alt=""><h1>Finish incomplete haven attributes substituting missings with values</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>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/ds2dd_detailed.R" class="external-link"><code>R/ds2dd_detailed.R</code></a></small>
<div class="d-none name"><code>haven_all_levels.Rd</code></div>
</div>

View File

@ -55,30 +55,12 @@
<dd>Split REDCap repeating instruments table into multiple tables</dd>
</dl><dl><dt>
<code><a href="as_factor.html">as_factor()</a></code>
</dt>
<dd>Convert labelled vectors to factors while preserving attributes</dd>
</dl><dl><dt>
<code><a href="case_match_regex_list.html">case_match_regex_list()</a></code>
</dt>
<dd>List-base regex case_when</dd>
</dl><dl><dt>
<code><a href="cast_data_overview.html">cast_data_overview()</a></code>
</dt>
<dd>Overview of REDCapCAST data for shiny</dd>
</dl><dl><dt>
<code><a href="cast_meta_overview.html">cast_meta_overview()</a></code>
</dt>
<dd>Overview of REDCapCAST meta data for shiny</dd>
</dl><dl><dt>
<code><a href="char2choice.html">char2choice()</a></code>
</dt>
@ -145,12 +127,6 @@
<dd>Creates zip-file with necessary content to manually add instrument to database</dd>
</dl><dl><dt>
<code><a href="fct2num.html">fct2num()</a></code>
</dt>
<dd>Allows conversion of factor to numeric values preserving original levels</dd>
</dl><dl><dt>
<code><a href="file_extension.html">file_extension()</a></code>
</dt>
@ -247,18 +223,6 @@
<dd>mtcars dataset slightly modified to use for Shiny app upload demonstration</dd>
</dl><dl><dt>
<code><a href="named_levels.html">named_levels()</a></code>
</dt>
<dd>Get named vector of factor levels and values</dd>
</dl><dl><dt>
<code><a href="nav_bar_page.html">nav_bar_page()</a></code>
</dt>
<dd>Nav_bar defining function for shiny ui</dd>
</dl><dl><dt>
<code><a href="numchar2fct.html">numchar2fct()</a></code>
</dt>

View File

@ -1,107 +0,0 @@
<!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>Get named vector of factor levels and values — named_levels • 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="Get named vector of factor levels and values — named_levels"><meta name="description" content="Get named vector of factor levels and values"><meta property="og:description" content="Get named vector of factor levels and values"><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.2</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>Get named vector of factor levels and values</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>named_levels.Rd</code></div>
</div>
<div class="ref-description section level2">
<p>Get named vector of factor levels and values</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">named_levels</span><span class="op">(</span><span class="va">data</span>, label <span class="op">=</span> <span class="st">"labels"</span>, na.label <span class="op">=</span> <span class="cn">NULL</span>, na.value <span class="op">=</span> <span class="fl">99</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>factor</p></dd>
<dt id="arg-label">label<a class="anchor" aria-label="anchor" href="#arg-label"></a></dt>
<dd><p>character string of attribute with named vector of factor labels</p></dd>
<dt id="arg-na-label">na.label<a class="anchor" aria-label="anchor" href="#arg-na-label"></a></dt>
<dd><p>character string to refactor NA values. Default is NULL.</p></dd>
<dt id="arg-na-value">na.value<a class="anchor" aria-label="anchor" href="#arg-na-value"></a></dt>
<dd><p>new value for NA strings. Ignored if na.label is NULL.
Default is 99.</p></dd>
</dl></div>
<div class="section level2">
<h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
<p>named vector</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="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></span>
<span class="r-in"><span> <span class="fu"><a href="as_factor.html">as_factor</a></span><span class="op">(</span><span class="op">)</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu">named_levels</span><span class="op">(</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>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

@ -1,74 +0,0 @@
<!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>Nav_bar defining function for shiny ui — nav_bar_page • 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="Nav_bar defining function for shiny ui — nav_bar_page"><meta name="description" content="Nav_bar defining function for shiny ui"><meta property="og:description" content="Nav_bar defining function for shiny ui"><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.2</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>Nav_bar defining function for shiny ui</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/shiny_cast.R" class="external-link"><code>R/shiny_cast.R</code></a></small>
<div class="d-none name"><code>nav_bar_page.Rd</code></div>
</div>
<div class="ref-description section level2">
<p>Nav_bar defining function for shiny ui</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">nav_bar_page</span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
</div>
<div class="section level2">
<h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
<p>shiny object</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

@ -85,11 +85,21 @@ Default is 6.</p></dd>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ am : num 1 1 1 0 0 0 0 0 0 0 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ gear: num 4 4 4 3 3 3 3 4 4 4 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ carb: num 4 4 1 1 2 1 4 2 2 4 ...</span>
<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="va">mtcars</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu">numchar2fct</span><span class="op">(</span>numeric.threshold <span class="op">=</span> <span class="fl">6</span><span class="op">)</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><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="r-in"><span><span class="op">}</span> <span class="co"># }</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 'data.frame': 32 obs. of 11 variables:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ mpg : num 21 21 22.8 21.4 18.7 18.1 14.3 24.4 22.8 19.2 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ cyl : Factor w/ 3 levels "4","6","8": 2 2 1 2 3 2 3 1 1 2 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ disp: num 160 160 108 258 360 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ hp : num 110 110 93 110 175 105 245 62 95 123 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ drat: num 3.9 3.9 3.85 3.08 3.15 2.76 3.21 3.69 3.92 3.92 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ wt : num 2.62 2.88 2.32 3.21 3.44 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ qsec: num 16.5 17 18.6 19.4 17 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ vs : Factor w/ 2 levels "0","1": 1 1 2 2 1 2 1 2 2 2 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ am : Factor w/ 2 levels "0","1": 2 2 2 1 1 1 1 1 1 1 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ gear: Factor w/ 3 levels "3","4","5": 2 2 2 1 1 1 1 2 2 2 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ carb: Factor w/ 6 levels "1","2","3","4",..: 4 4 1 1 2 1 4 2 2 4 ...</span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>

View File

@ -89,11 +89,21 @@
<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="va">mtcars</span> <span class="op">|&gt;</span></span></span>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="va">mtcars</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu">parse_data</span><span class="op">(</span><span class="op">)</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><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="r-in"><span><span class="op">}</span> <span class="co"># }</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 'data.frame': 32 obs. of 11 variables:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ mpg : num 21 21 22.8 21.4 18.7 18.1 14.3 24.4 22.8 19.2 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ cyl : num 6 6 4 6 8 6 8 4 4 6 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ disp: num 160 160 108 258 360 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ hp : num 110 110 93 110 175 105 245 62 95 123 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ drat: num 3.9 3.9 3.85 3.08 3.15 2.76 3.21 3.69 3.92 3.92 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ wt : num 2.62 2.88 2.32 3.21 3.44 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ qsec: num 16.5 17 18.6 19.4 17 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ vs : num 0 0 1 1 0 1 0 1 1 1 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ am : num 1 1 1 0 0 0 0 0 0 0 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ gear: num 4 4 4 3 3 3 3 4 4 4 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> $ carb: num 4 4 1 1 2 1 4 2 2 4 ...</span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>

View File

@ -34,7 +34,7 @@
<div class="row">
<main id="main" class="col-md-9"><div class="page-header">
<img src="../logo.png" class="logo" alt=""><h1>Set attributes for named attribute. Appends if attr is NULL</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>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/ds2dd_detailed.R" class="external-link"><code>R/ds2dd_detailed.R</code></a></small>
<div class="d-none name"><code>set_attr.Rd</code></div>
</div>
@ -44,7 +44,7 @@
<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">set_attr</span><span class="op">(</span><span class="va">data</span>, <span class="va">label</span>, attr <span class="op">=</span> <span class="cn">NULL</span>, overwrite <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span></code></pre></div>
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">set_attr</span><span class="op">(</span><span class="va">data</span>, <span class="va">label</span>, attr <span class="op">=</span> <span class="cn">NULL</span><span class="op">)</span></span></code></pre></div>
</div>
<div class="section level2">
@ -62,10 +62,6 @@
<dt id="arg-attr">attr<a class="anchor" aria-label="anchor" href="#arg-attr"></a></dt>
<dd><p>attribute name</p></dd>
<dt id="arg-overwrite">overwrite<a class="anchor" aria-label="anchor" href="#arg-overwrite"></a></dt>
<dd><p>overwrite existing attributes. Default is FALSE.</p></dd>
</dl></div>
<div class="section level2">
<h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>

View File

@ -69,15 +69,19 @@ factoring, but levels character vectors in order of appearance.</p>
<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="fu"><a href="https://rdrr.io/r/base/sample.html" class="external-link">sample</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/seq.html" class="external-link">seq_len</a></span><span class="op">(</span><span class="fl">4</span><span class="op">)</span>, <span class="fl">20</span>, <span class="cn">TRUE</span><span class="op">)</span> <span class="op">|&gt;</span></span></span>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/sample.html" class="external-link">sample</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/seq.html" class="external-link">seq_len</a></span><span class="op">(</span><span class="fl">4</span><span class="op">)</span>, <span class="fl">20</span>, <span class="cn">TRUE</span><span class="op">)</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu">var2fct</span><span class="op">(</span><span class="fl">6</span><span class="op">)</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 2 3 4 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 6 7 3 </span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/sample.html" class="external-link">sample</a></span><span class="op">(</span><span class="va">letters</span>, <span class="fl">20</span><span class="op">)</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu">var2fct</span><span class="op">(</span><span class="fl">6</span><span class="op">)</span> <span class="op">|&gt;</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Length Class Mode </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 20 character character </span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/sample.html" class="external-link">sample</a></span><span class="op">(</span><span class="va">letters</span><span class="op">[</span><span class="fl">1</span><span class="op">:</span><span class="fl">4</span><span class="op">]</span>, <span class="fl">20</span>, <span class="cn">TRUE</span><span class="op">)</span> <span class="op">|&gt;</span> <span class="fu">var2fct</span><span class="op">(</span><span class="fl">6</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span> <span class="co"># }</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] c d d d c b c b c b c b d b a c b b c a</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Levels: c d b a</span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>

File diff suppressed because one or more lines are too long

View File

@ -11,10 +11,7 @@
<url><loc>https://agdamsbo.github.io/REDCapCAST/news/index.html</loc></url>
<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/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>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/cast_meta_overview.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/char2choice.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/char2cond.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/clean_redcap_name.html</loc></url>
@ -26,7 +23,6 @@
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/ds2dd_detailed.html</loc></url>
<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/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>
@ -44,8 +40,6 @@
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/mark_complete.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/match_fields_to_form.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/mtcars_redcap.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/named_levels.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/nav_bar_page.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/numchar2fct.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/parse_data.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/process_user_input.character.html</loc></url>