Deploying to gh-pages from @ agdamsbo/REDCapCAST@db75c3313e 🚀

This commit is contained in:
agdamsbo 2025-11-14 14:10:52 +00:00
parent bc2e23a272
commit 0b30252598
171 changed files with 7009 additions and 602 deletions

View file

@ -1,17 +1,16 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Page not found (404) • REDCapCAST</title> <title>Page not found (404) • REDCapCAST</title>
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="https://agdamsbo.github.io/REDCapCAST/favicon-16x16.png"> <!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="https://agdamsbo.github.io/REDCapCAST/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="32x32" href="https://agdamsbo.github.io/REDCapCAST/favicon-32x32.png"> <link rel="icon" type="”image/svg+xml”" href="https://agdamsbo.github.io/REDCapCAST/favicon.svg">
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="https://agdamsbo.github.io/REDCapCAST/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="180x180" href="https://agdamsbo.github.io/REDCapCAST/apple-touch-icon.png">
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="https://agdamsbo.github.io/REDCapCAST/apple-touch-icon-120x120.png"> <link rel="icon" sizes="any" href="https://agdamsbo.github.io/REDCapCAST/favicon.ico">
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="https://agdamsbo.github.io/REDCapCAST/apple-touch-icon-76x76.png"> <link rel="manifest" href="https://agdamsbo.github.io/REDCapCAST/site.webmanifest">
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="https://agdamsbo.github.io/REDCapCAST/apple-touch-icon-60x60.png">
<script src="https://agdamsbo.github.io/REDCapCAST/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"> <script src="https://agdamsbo.github.io/REDCapCAST/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="https://agdamsbo.github.io/REDCapCAST/deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"> <link href="https://agdamsbo.github.io/REDCapCAST/deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet">
<script src="https://agdamsbo.github.io/REDCapCAST/deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="https://agdamsbo.github.io/REDCapCAST/deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"> <script src="https://agdamsbo.github.io/REDCapCAST/deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="https://agdamsbo.github.io/REDCapCAST/deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet">
@ -26,7 +25,7 @@
<a class="navbar-brand me-2" href="https://agdamsbo.github.io/REDCapCAST/index.html">REDCapCAST</a> <a class="navbar-brand me-2" href="https://agdamsbo.github.io/REDCapCAST/index.html">REDCapCAST</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -75,7 +74,7 @@ Content not found. Please use links in the navbar.
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer> </footer>

3
404.md Normal file
View file

@ -0,0 +1,3 @@
Content not found. Please use links in the navbar.
# Page not found (404)

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Contributor Covenant Code of Conduct • 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="Contributor Covenant Code of Conduct"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Contributor Covenant Code of Conduct • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png"><link rel="icon" sizes="any" href="favicon.ico"><link rel="manifest" href="site.webmanifest"><script src="deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="deps/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="Contributor Covenant Code of Conduct"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Contributor Covenant Code of Conduct</h1> <h1>Contributor Covenant Code of Conduct</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/CODE_OF_CONDUCT.md" class="external-link"><code>CODE_OF_CONDUCT.md</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/CODE_OF_CONDUCT.md" class="external-link"><code>CODE_OF_CONDUCT.md</code></a></small>
</div> </div>
<div id="contributor-covenant-code-of-conduct" class="section level1"> <div id="contributor-covenant-code-of-conduct" class="section level1">
@ -115,7 +115,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

132
CODE_OF_CONDUCT.md Normal file
View file

@ -0,0 +1,132 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in
our community a harassment-free experience for everyone, regardless of
age, body size, visible or invisible disability, ethnicity, sex
characteristics, gender identity and expression, level of experience,
education, socio-economic status, nationality, personal appearance,
race, caste, color, religion, or sexual identity and orientation.
We pledge to act and interact in ways that contribute to an open,
welcoming, diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our
mistakes, and learning from the experience
- Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
- Trolling, insulting or derogatory comments, and personal or political
attacks
- Public or private harassment
- Publishing others private information, such as a physical or email
address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our
standards of acceptable behavior and will take appropriate and fair
corrective action in response to any behavior that they deem
inappropriate, threatening, offensive, or harmful.
Community leaders have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other
contributions that are not aligned to this Code of Conduct, and will
communicate reasons for moderation decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also
applies when an individual is officially representing the community in
public spaces. Examples of representing our community include using an
official e-mail address, posting via an official social media account,
or acting as an appointed representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may
be reported to the community leaders responsible for enforcement at
<andreas@gdamsbo.dk>. All complaints will be reviewed and investigated
promptly and fairly.
All community leaders are obligated to respect the privacy and security
of the reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in
determining the consequences for any action they deem in violation of
this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior
deemed unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders,
providing clarity around the nature of the violation and an explanation
of why the behavior was inappropriate. A public apology may be
requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, for a specified period of
time. This includes avoiding interactions in community spaces as well as
external channels like social media. Violating these terms may lead to a
temporary or permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards,
including sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No
public or private interaction with the people involved, including
unsolicited interaction with those enforcing the Code of Conduct, is
allowed during this period. Violating these terms may lead to a
permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of
individuals.
**Consequence**: A permanent ban from any sort of public interaction
within the community.
## Attribution
This Code of Conduct is adapted from the [Contributor
Covenant](https://www.contributor-covenant.org), version 2.1, available
at
<https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>.
Community Impact Guidelines were inspired by [Mozillas code of conduct
enforcement ladder](https://github.com/mozilla/inclusion).
For answers to common questions about this code of conduct, see the FAQ
at <https://www.contributor-covenant.org/faq>. Translations are
available at <https://www.contributor-covenant.org/translations>.

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>GNU General Public License • 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="GNU General Public License"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>GNU General Public License • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png"><link rel="icon" sizes="any" href="favicon.ico"><link rel="manifest" href="site.webmanifest"><script src="deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="deps/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="GNU General Public License"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>GNU General Public License</h1> <h1>GNU General Public License</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/LICENSE.md" class="external-link"><code>LICENSE.md</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/LICENSE.md" class="external-link"><code>LICENSE.md</code></a></small>
</div> </div>
<div id="gnu-general-public-license" class="section level1"> <div id="gnu-general-public-license" class="section level1">
@ -244,7 +244,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

669
LICENSE.md Normal file
View file

@ -0,0 +1,669 @@
# GNU General Public License
*Version 3, 29 June 2007*
*Copyright © 2007 Free Software Foundation, Inc. \<<http://fsf.org/>\>*
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
## Preamble
The GNU General Public License is a free, copyleft license for software
and other kinds of works.
The licenses for most software and other practical works are designed to
take away your freedom to share and change the works. By contrast, the
GNU General Public License is intended to guarantee your freedom to
share and change all versions of a programto make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not price.
Our General Public Licenses are designed to make sure that you have the
freedom to distribute copies of free software (and charge for them if
you wish), that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you these
rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether gratis
or for a fee, you must pass on to the recipients the same freedoms that
you received. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
Developers that use the GNU GPL protect your rights with two steps:
**(1)** assert copyright on the software, and **(2)** offer you this
License giving you legal permission to copy, distribute and/or modify
it.
For the developers and authors protection, the GPL clearly explains
that there is no warranty for this free software. For both users and
authors sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of protecting
users freedom to change the software. The systematic pattern of such
abuse occurs in the area of products for individuals to use, which is
precisely where it is most unacceptable. Therefore, we have designed
this version of the GPL to prohibit the practice for those products. If
such problems arise substantially in other domains, we stand ready to
extend this provision to those domains in future versions of the GPL, as
needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
## TERMS AND CONDITIONS
### 0. Definitions
“This License” refers to version 3 of the GNU General Public License.
“Copyright” also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
“The Program” refers to any copyrightable work licensed under this
License. Each licensee is addressed as “you”. “Licensees” and
“recipients” may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a “modified version” of the
earlier work or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based on
the Program.
To “propagate” a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices” to
the extent that it includes a convenient and prominently visible feature
that **(1)** displays an appropriate copyright notice, and **(2)** tells
the user that there is no warranty for the work (except to the extent
that warranties are provided), that licensees may convey the work under
this License, and how to view a copy of this License. If the interface
presents a list of user commands or options, such as a menu, a prominent
item in the list meets this criterion.
### 1. Source Code
The “source code” for a work means the preferred form of the work for
making modifications to it. “Object code” means any non-source form of a
work.
A “Standard Interface” means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that is
widely used among developers working in that language.
The “System Libraries” of an executable work include anything, other
than the work as a whole, that **(a)** is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and **(b)** serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A “Major
Component”, in this context, means a major essential component (kernel,
window system, and so on) of the specific operating system (if any) on
which the executable work runs, or a compiler used to produce the work,
or an object code interpreter used to run it.
The “Corresponding Source” for a work in object code form means all the
source code needed to generate, install, and (for an executable work)
run the object code and to modify the work, including scripts to control
those activities. However, it does not include the works System
Libraries, or general-purpose tools or generally available free programs
which are used unmodified in performing those activities but which are
not part of the work. For example, Corresponding Source includes
interface definition files associated with source files for the work,
and the source code for shared libraries and dynamically linked
subprograms that the work is specifically designed to require, such as
by intimate data communication or control flow between those subprograms
and other parts of the work.
The Corresponding Source need not include anything that users can
regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same
work.
### 2. Basic Permissions
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey,
without conditions so long as your license otherwise remains in force.
You may convey covered works to others for the sole purpose of having
them make modifications exclusively for you, or provide you with
facilities for running those works, provided that you comply with the
terms of this License in conveying all material for which you do not
control copyright. Those thus making or running the covered works for
you must do so exclusively on your behalf, under your direction and
control, on terms that prohibit them from making any copies of your
copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the
conditions stated below. Sublicensing is not allowed; section 10 makes
it unnecessary.
### 3. Protecting Users Legal Rights From Anti-Circumvention Law
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article 11
of the WIPO copyright treaty adopted on 20 December 1996, or similar
laws prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to the
covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the works
users, your or third parties legal rights to forbid circumvention of
technological measures.
### 4. Conveying Verbatim Copies
You may convey verbatim copies of the Programs source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice; keep
intact all notices stating that this License and any non-permissive
terms added in accord with section 7 apply to the code; keep intact all
notices of the absence of any warranty; and give all recipients a copy
of this License along with the Program.
You may charge any price or no price for each copy that you convey, and
you may offer support or warranty protection for a fee.
### 5. Conveying Modified Source Versions
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the terms
of section 4, provided that you also meet all of these conditions:
- **a)** The work must carry prominent notices stating that you modified
it, and giving a relevant date.
- **b)** The work must carry prominent notices stating that it is
released under this License and any conditions added under section 7.
This requirement modifies the requirement in section 4 to “keep intact
all notices”.
- **c)** You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This License
will therefore apply, along with any applicable section 7 additional
terms, to the whole of the work, and all its parts, regardless of how
they are packaged. This License gives no permission to license the
work in any other way, but it does not invalidate such permission if
you have separately received it.
- **d)** If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your work
need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work, and
which are not combined with it such as to form a larger program, in or
on a volume of a storage or distribution medium, is called an
“aggregate” if the compilation and its resulting copyright are not used
to limit the access or legal rights of the compilations users beyond
what the individual works permit. Inclusion of a covered work in an
aggregate does not cause this License to apply to the other parts of the
aggregate.
### 6. Conveying Non-Source Forms
You may convey a covered work in object code form under the terms of
sections 4 and 5, provided that you also convey the machine-readable
Corresponding Source under the terms of this License, in one of these
ways:
- **a)** Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium customarily
used for software interchange.
- **b)** Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a written
offer, valid for at least three years and valid for as long as you
offer spare parts or customer support for that product model, to give
anyone who possesses the object code either **(1)** a copy of the
Corresponding Source for all the software in the product that is
covered by this License, on a durable physical medium customarily used
for software interchange, for a price no more than your reasonable
cost of physically performing this conveying of source, or **(2)**
access to copy the Corresponding Source from a network server at no
charge.
- **c)** Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This alternative is
allowed only occasionally and noncommercially, and only if you
received the object code with such an offer, in accord with subsection
6b.
- **d)** Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to copy
the object code is a network server, the Corresponding Source may be
on a different server (operated by you or a third party) that supports
equivalent copying facilities, provided you maintain clear directions
next to the object code saying where to find the Corresponding Source.
Regardless of what server hosts the Corresponding Source, you remain
obligated to ensure that it is available for as long as needed to
satisfy these requirements.
- **e)** Convey the object code using peer-to-peer transmission,
provided you inform other peers where the object code and
Corresponding Source of the work are being offered to the general
public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be included
in conveying the object code work.
A “User Product” is either **(1)** a “consumer product”, which means any
tangible personal property which is normally used for personal, family,
or household purposes, or **(2)** anything designed or sold for
incorporation into a dwelling. In determining whether a product is a
consumer product, doubtful cases shall be resolved in favor of coverage.
For a particular product received by a particular user, “normally used”
refers to a typical or common use of that class of product, regardless
of the status of the particular user or of the way in which the
particular user actually uses, or expects or is expected to use, the
product. A product is a consumer product regardless of whether the
product has substantial commercial, industrial or non-consumer uses,
unless such uses represent the only significant mode of use of the
product.
“Installation Information” for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product
from a modified version of its Corresponding Source. The information
must suffice to ensure that the continued functioning of the modified
object code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied by
the Installation Information. But this requirement does not apply if
neither you nor any third party retains the ability to install modified
object code on the User Product (for example, the work has been
installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided, in
accord with this section must be in a format that is publicly documented
(and with an implementation available to the public in source code
form), and must require no special password or key for unpacking,
reading or copying.
### 7. Additional Terms
“Additional permissions” are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by this
License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove
any additional permissions from that copy, or from any part of it.
(Additional permissions may be written to require their own removal in
certain cases when you modify the work.) You may place additional
permissions on material, added by you to a covered work, for which you
have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders
of that material) supplement the terms of this License with terms:
- **a)** Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
- **b)** Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
- **c)** Prohibiting misrepresentation of the origin of that material,
or requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
- **d)** Limiting the use for publicity purposes of names of licensors
or authors of the material; or
- **e)** Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
- **f)** Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered “further
restrictions” within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains a
further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms of
that license document, provided that the further restriction does not
survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must
place, in the relevant source files, a statement of the additional terms
that apply to those files, or a notice indicating where to find the
applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions; the above
requirements apply either way.
### 8. Termination
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated **(a)** provisionally,
unless and until the copyright holder explicitly and finally terminates
your license, and **(b)** permanently, if the copyright holder fails to
notify you of the violation by some reasonable means prior to 60 days
after the cessation.
Moreover, your license from a particular copyright holder is reinstated
permanently if the copyright holder notifies you of the violation by
some reasonable means, this is the first time you have received notice
of violation of this License (for any work) from that copyright holder,
and you cure the violation prior to 30 days after your receipt of the
notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
### 9. Acceptance Not Required for Having Copies
You are not required to accept this License in order to receive or run a
copy of the Program. Ancillary propagation of a covered work occurring
solely as a consequence of using peer-to-peer transmission to receive a
copy likewise does not require acceptance. However, nothing other than
this License grants you permission to propagate or modify any covered
work. These actions infringe copyright if you do not accept this
License. Therefore, by modifying or propagating a covered work, you
indicate your acceptance of this License to do so.
### 10. Automatic Licensing of Downstream Recipients
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An “entity transaction” is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered work
results from an entity transaction, each party to that transaction who
receives a copy of the work also receives whatever licenses to the work
the partys predecessor in interest had or could give under the previous
paragraph, plus a right to possession of the Corresponding Source of the
work from the predecessor in interest, if the predecessor has it or can
get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may not
impose a license fee, royalty, or other charge for exercise of rights
granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that any
patent claim is infringed by making, using, selling, offering for sale,
or importing the Program or any portion of it.
### 11. Patents
A “contributor” is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The work
thus licensed is called the contributors “contributor version”.
A contributors “essential patent claims” are all patent claims owned or
controlled by the contributor, whether already acquired or hereafter
acquired, that would be infringed by some manner, permitted by this
License, of making, using, or selling its contributor version, but do
not include claims that would be infringed only as a consequence of
further modification of the contributor version. For purposes of this
definition, “control” includes the right to grant patent sublicenses in
a manner consistent with the requirements of this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributors essential patent claims, to make,
use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a “patent license” is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To “grant” such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license, and
the Corresponding Source of the work is not available for anyone to
copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either **(1)** cause the Corresponding Source to be so
available, or **(2)** arrange to deprive yourself of the benefit of the
patent license for this particular work, or **(3)** arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. “Knowingly relying” means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipients use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify or
convey a specific copy of the covered work, then the patent license you
grant is automatically extended to all recipients of the covered work
and works based on it.
A patent license is “discriminatory” if it does not include within the
scope of its coverage, prohibits the exercise of, or is conditioned on
the non-exercise of one or more of the rights that are specifically
granted under this License. You may not convey a covered work if you are
a party to an arrangement with a third party that is in the business of
distributing software, under which you make payment to the third party
based on the extent of your activity of conveying the work, and under
which the third party grants, to any of the parties who would receive
the covered work from you, a discriminatory patent license **(a)** in
connection with copies of the covered work conveyed by you (or copies
made from those copies), or **(b)** primarily for and in connection with
specific products or compilations that contain the covered work, unless
you entered into that arrangement, or that patent license was granted,
prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any
implied license or other defenses to infringement that may otherwise be
available to you under applicable patent law.
### 12. No Surrender of Others Freedom
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not convey it at all. For example, if you agree to terms that
obligate you to collect a royalty for further conveying from those to
whom you convey the Program, the only way you could satisfy both those
terms and this License would be to refrain entirely from conveying the
Program.
### 13. Use with the GNU Affero General Public License
Notwithstanding any other provision of this License, you have permission
to link or combine any covered work with a work licensed under version 3
of the GNU Affero General Public License into a single combined work,
and to convey the resulting work. The terms of this License will
continue to apply to the part which is the covered work, but the special
requirements of the GNU Affero General Public License, section 13,
concerning interaction through a network will apply to the combination
as such.
### 14. Revised Versions of this License
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies that a certain numbered version of the GNU General Public
License “or any later version” applies to it, you have the option of
following the terms and conditions either of that numbered version or of
any later version published by the Free Software Foundation. If the
Program does not specify a version number of the GNU General Public
License, you may choose any version ever published by the Free Software
Foundation.
If the Program specifies that a proxy can decide which future versions
of the GNU General Public License can be used, that proxys public
statement of acceptance of a version permanently authorizes you to
choose that version for the Program.
Later license versions may give you additional or different permissions.
However, no additional obligations are imposed on any author or
copyright holder as a result of your choosing to follow a later version.
### 15. Disclaimer of Warranty
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF
THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
### 16. Limitation of Liability
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES
SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE
WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
### 17. Interpretation of Sections 15 and 16
If the disclaimer of warranty and limitation of liability provided above
cannot be given local legal effect according to their terms, reviewing
courts shall apply local law that most closely approximates an absolute
waiver of all civil liability in connection with the Program, unless a
warranty or assumption of liability accompanies a copy of the Program in
return for a fee.
*END OF TERMS AND CONDITIONS*
## How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively state
the exclusion of warranty; and each file should have at least the
“copyright” line and a pointer to where the full notice is found.
``` R
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
```
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice
like this when it starts in an interactive mode:
``` R
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'show c' for details.
```
The hypothetical commands `show w` and `show c` should show the
appropriate parts of the General Public License. Of course, your
programs commands might be different; for a GUI interface, you would
use an “about box”.
You should also get your employer (if you work as a programmer) or
school, if any, to sign a “copyright disclaimer” for the program, if
necessary. For more information on this, and how to apply and follow the
GNU GPL, see \<<http://www.gnu.org/licenses/>\>.
The GNU General Public License does not permit incorporating your
program into proprietary programs. If your program is a subroutine
library, you may consider it more useful to permit linking proprietary
applications with the library. If this is what you want to do, use the
GNU Lesser General Public License instead of this License. But first,
please read
\<[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.md)\>.

View file

@ -1,17 +1,16 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Database-creation • REDCapCAST</title> <title>Database-creation • REDCapCAST</title>
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"> <!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png">
<link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"> <link rel="icon" type="”image/svg+xml”" href="../favicon.svg">
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"> <link rel="apple-touch-icon" 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="icon" sizes="any" href="../favicon.ico">
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"> <link rel="manifest" href="../site.webmanifest">
<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"> <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"> <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"> <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">
@ -26,7 +25,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -67,7 +66,7 @@
<h1>Database-creation</h1> <h1>Database-creation</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/vignettes/Database-creation.Rmd" class="external-link"><code>vignettes/Database-creation.Rmd</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/vignettes/Database-creation.Rmd" class="external-link"><code>vignettes/Database-creation.Rmd</code></a></small>
<div class="d-none name"><code>Database-creation.Rmd</code></div> <div class="d-none name"><code>Database-creation.Rmd</code></div>
</div> </div>
@ -187,7 +186,7 @@ upload: manual or through <code>REDCapR</code>.</p>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer> </footer>

View file

@ -0,0 +1,117 @@
# Database-creation
``` r
library(REDCapCAST)
```
## Two different ways to create a data base
`REDCapCAST` provides two approaches to creating a data dictionary aimed
at helping out in two different cases:
1. Easily create a REDCap data base from an existing data set.
2. Create a table in Word describing a variables in a data base and use
this to create a data base.
In the following I will try to come with a few suggestions on how to use
these approaches.
### Easy data set to data base workflow
The first iteration of a dataset to data dictionary function is the
[`ds2dd()`](https://agdamsbo.github.io/REDCapCAST/reference/ds2dd.md),
which creates a very basic data dictionary with all variables stored as
text. This is sufficient for just storing old datasets/spreadsheets
securely in REDCap.
``` r
d1 <- mtcars |>
dplyr::mutate(record_id = seq_len(dplyr::n())) |>
ds2dd()
d1 |>
gt::gt()
```
The more advanced
[`ds2dd_detailed()`](https://agdamsbo.github.io/REDCapCAST/reference/ds2dd_detailed.md)
is a natural development. It will try to apply the most common data
classes for data validation and will assume that the first column is the
id number. It outputs a list with the dataset with modified variable
names to comply with REDCap naming conventions and a data dictionary.
The dataset should be correctly formatted for the data dictionary to
preserve as much information as possible.
``` r
d2 <- REDCapCAST::redcapcast_data |>
dplyr::mutate(record_id = seq_len(dplyr::n()),
region=factor(region)) |>
dplyr::select(record_id, dplyr::everything()) |>
(\(.x){
.x[!grepl("_complete$",names(.x))]
})() |>
(\(.x){
.x[!grepl("^redcap",names(.x))]
})() |>
ds2dd_detailed() |>
purrr::pluck("meta")
d2 |>
gt::gt()
```
Additional specifications to the DataDictionary can be made manually, or
it can be uploaded and modified manually in the graphical user interface
on the REDCap server.
### Data base from table
…instructions and examples are coming…
### Meta data and data upload
Now the DataDictionary can be exported as a spreadsheet and uploaded or
it can be uploaded using the `REDCapR` package (only projects with
“Development” status).
Use one of the two approaches below:
#### Manual upload
``` r
write.csv(dd_ls$meta, "datadictionary.csv")
```
#### Upload with `REDCapR`
``` r
REDCapR::redcap_metadata_write(
dd_ls$meta,
redcap_uri = keyring::key_get("DB_URI"),
token = keyring::key_get("DB_TOKEN")
)
```
In the [“REDCap R
Handbook”](https://agdamsbo.github.io/redcap-r-handbook/) more is
written on interfacing with REDCap in R using the
[`library(keyring)`](https://keyring.r-lib.org/)to store credentials in
[chapter
1.1](https://agdamsbo.github.io/redcap-r-handbook/doc/access.html#sec-getting-access).
### Step 4 - Data upload
The same two options are available for data upload as meta data upload:
manual or through `REDCapR`.
Only the latter is shown here.
``` r
REDCapR::redcap_write(
dd_ls$data,
redcap_uri = keyring::key_get("DB_URI"),
token = keyring::key_get("DB_TOKEN")
)
```

View file

@ -1,17 +1,16 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>REDCapCAST • REDCapCAST</title> <title>REDCapCAST • REDCapCAST</title>
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"> <!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png">
<link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"> <link rel="icon" type="”image/svg+xml”" href="../favicon.svg">
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"> <link rel="apple-touch-icon" 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="icon" sizes="any" href="../favicon.ico">
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"> <link rel="manifest" href="../site.webmanifest">
<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"> <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"> <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"> <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">
@ -26,7 +25,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -67,7 +66,7 @@
<h1>REDCapCAST</h1> <h1>REDCapCAST</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/vignettes/REDCapCAST.Rmd" class="external-link"><code>vignettes/REDCapCAST.Rmd</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/vignettes/REDCapCAST.Rmd" class="external-link"><code>vignettes/REDCapCAST.Rmd</code></a></small>
<div class="d-none name"><code>REDCapCAST.Rmd</code></div> <div class="d-none name"><code>REDCapCAST.Rmd</code></div>
</div> </div>
@ -2984,7 +2983,7 @@ format):</p>
<td headers="stat_0" class="gt_row gt_center">5</td> <td headers="stat_0" class="gt_row gt_center">5</td>
</tr> </tr>
</tbody> </tbody>
<tfoot class="gt_footnotes"><tr> <tfoot><tr class="gt_footnotes">
<td class="gt_footnote" colspan="2"> <td class="gt_footnote" colspan="2">
<span class="gt_footnote_marks" style="white-space:nowrap;font-style:italic;font-weight:normal;line-height:0;"><sup>1</sup></span> <span class="gt_from_md">n (%)</span> <span class="gt_footnote_marks" style="white-space:nowrap;font-style:italic;font-weight:normal;line-height:0;"><sup>1</sup></span> <span class="gt_from_md">n (%)</span>
</td> </td>
@ -3003,7 +3002,7 @@ format):</p>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer> </footer>

357
articles/REDCapCAST.md Normal file
View file

@ -0,0 +1,357 @@
# REDCapCAST
``` r
library(REDCapCAST)
```
This vignette covers the basics to get you started with the two basic
features of REDCapCAST:
- Casting REDCap metadata to create a new REDCap database or extend an
existing with a new instrument
- Reading REDCap data in a convenient and focused way, by only getting
the data you need, while preserving as much metadata as possible.
## Casting meta data
The easiest way is to use the
[`shiny_cast()`](https://agdamsbo.github.io/REDCapCAST/reference/shiny_cast.md).
You can access a [hosted version
here](https://agdamsbo.shinyapps.io/redcapcast/) or launch it locally
like this:
``` r
shiny_cast()
```
## Reading data from REDCap
To get you started, the easiest way possible, you can use the
[`easy_redcap()`](https://agdamsbo.github.io/REDCapCAST/reference/easy_redcap.md)
function (example below).
You will need an API-key for your REDCap server, the uri/URL/address for
the API connection (usually the address used for accessing your
institutions REDCap server, with an appended “/api/”).
This function includes a few convenience features to ease your further
work.
If your project uses repeating instruments possible as a longitudinal
project, you can choose to widen the data. If not, the result will be a
list of each instrument you have chosen to extract data from. Make sure
to specify only the fields or instruments you need, and avoid to save
any of the data locally, but always source from REDCap to avoid possibly
insecure local storage of sensitive data.
``` r
easy_redcap(
uri = "YOUR URI",
project.name = "MY_PROJECT",
widen.data = TRUE,
fields = c("record_id", "OTHER FIELDS")
)
```
## Splitting the dataset
The
[`easy_redcap()`](https://agdamsbo.github.io/REDCapCAST/reference/easy_redcap.md)
function does a few things under the hood. Below are a few examples to
show how the nicely formatted output is achieved.
A sample dataset and Data Dictionary/metadata is provided for this
demonstration:
``` r
redcapcast_data |> gt::gt()
```
| record_id | redcap_event_name | redcap_repeat_instrument | redcap_repeat_instance | cpr | inclusion | inclusion_time | dob | age | age_integer | sex | cohabitation | hypertension | diabetes | region | baseline_data_start_complete | mrs_assessed | mrs_date | mrs_score | mrs_complete | con_mrs | con_calc | consensus_complete | event_datetime | event_age | event_type | new_event_complete |
|-----------|-------------------|--------------------------|------------------------|------------|------------|----------------|------------|-----------|-------------|--------|--------------|--------------|----------|--------|------------------------------|--------------|------------|-----------|--------------|---------|----------|--------------------|---------------------|-----------|------------|--------------------|
| 1 | inclusion | NA | NA | 1203401OB4 | 2023-03-13 | 12:38:49 | 1940-03-12 | 83.00239 | 83 | female | Yes | No | Yes | East | Incomplete | Yes | 2023-03-13 | 1 | Incomplete | NA | NA | NA | NA | NA | NA | NA |
| 2 | inclusion | NA | NA | 0102342303 | 2023-03-01 | 10:38:57 | 1934-02-01 | 89.07780 | 89 | male | Yes | No | No | South | Incomplete | Yes | 2023-03-07 | 1 | Incomplete | NA | NA | NA | NA | NA | NA | NA |
| 2 | follow1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | Yes | 2023-03-09 | 3 | Incomplete | NA | NA | Incomplete | NA | NA | NA | NA |
| 2 | follow1 | New Event (?) | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 2024-01-18 12:49:42 | NA | TIA | Incomplete |
| 3 | inclusion | NA | NA | 2301569823 | 2022-03-08 | 12:01:07 | 1956-01-23 | 66.12319 | 66 | male | No | Yes | Yes | North | Incomplete | NA | NA | NA | Incomplete | NA | NA | NA | NA | NA | NA | NA |
| 3 | follow1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | Yes | 2022-08-16 | 2 | Incomplete | NA | NA | Incomplete | NA | NA | NA | NA |
| 3 | follow2 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | Yes | 2023-03-13 | 1 | Incomplete | NA | NA | Incomplete | NA | NA | NA | NA |
| 3 | follow1 | New Event (?) | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 2024-01-18 12:49:58 | NA | AIS | Incomplete |
| 3 | follow1 | New Event (?) | 2 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 2024-01-18 12:50:01 | NA | ICH | Incomplete |
| 3 | follow2 | New Event (?) | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 2024-01-18 12:50:05 | NA | ICH | Incomplete |
| 3 | follow2 | New Event (?) | 2 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 2024-01-18 12:50:07 | NA | TIA | Incomplete |
| 3 | follow2 | New Event (?) | 3 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 2024-01-18 12:50:09 | NA | AIS | Incomplete |
| 4 | inclusion | NA | NA | 0204051342 | 2023-03-14 | 20:39:19 | 1905-04-02 | 117.94903 | 117 | female | NA | NA | NA | NA | Incomplete | NA | NA | NA | Incomplete | NA | NA | NA | NA | NA | NA | NA |
| 4 | follow1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | Incomplete | NA | NA | Incomplete | NA | NA | NA | NA |
| 4 | follow2 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | Incomplete | NA | NA | Incomplete | NA | NA | NA | NA |
| 4 | follow1 | New Event (?) | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 2001-04-11 08:39:05 | 96 | TIA | Complete |
| 4 | follow1 | New Event (?) | 2 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 2010-04-11 08:39:25 | 105 | TIA | Complete |
| 4 | follow2 | New Event (?) | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 2024-01-18 12:50:19 | 118 | AIS | Complete |
| 4 | follow2 | New Event (?) | 2 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 2024-01-18 12:50:22 | 118 | ICH | Incomplete |
| 4 | follow2 | New Event (?) | 3 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 2024-01-18 12:50:24 | 118 | Unknown | Complete |
| 5 | inclusion | NA | NA | 0201976043 | 2023-03-23 | 08:50:31 | 1897-01-02 | 126.21751 | 126 | male | No | Yes | Yes | East | Complete | NA | NA | NA | Incomplete | NA | NA | NA | NA | NA | NA | NA |
| 5 | follow1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | Incomplete | NA | NA | Incomplete | NA | NA | NA | NA |
| 5 | follow1 | New Event (?) | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 2024-04-11 09:00:33 | 127 | AIS | Complete |
| 5 | follow1 | New Event (?) | 2 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 2024-04-11 09:00:41 | 127 | ICH | Complete |
| 6 | inclusion | NA | NA | 1202320122 | 2024-01-25 | 08:49:28 | 1932-02-12 | 91.95261 | 91 | female | No | Yes | No | East | Complete | NA | NA | NA | Incomplete | NA | NA | NA | NA | NA | NA | NA |
``` r
redcapcast_meta |> gt::gt()
```
| field_name | form_name | section_header | field_type | field_label | select_choices_or_calculations | field_note | text_validation_type_or_show_slider_number | text_validation_min | text_validation_max | identifier | branching_logic | required_field | custom_alignment | question_number | matrix_group_name | matrix_ranking | field_annotation |
|----------------|---------------------|--------------------|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------|--------------------------------------------|---------------------|---------------------|------------|-----------------|----------------|------------------|-----------------|-------------------|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| record_id | baseline_data_start | NA | text | ID | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA |
| cpr | baseline_data_start | NA | text | CPR (Danish civil registration number) | NA | ddmmyyxxxx | NA | NA | NA | y | NA | y | NA | NA | NA | NA | NA |
| inclusion | baseline_data_start | NA | text | Inclusion date | NA | NA | date_ymd | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA |
| inclusion_time | baseline_data_start | NA | text | Inclusion time | NA | NA | time_hh_mm_ss | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA |
| dob | baseline_data_start | NA | text | Date of birth (From CPR) | NA | NA | date_ymd | NA | NA | NA | NA | NA | NA | NA | NA | NA | @CALCTEXT(if(\[cpr\]!="", concat(if(mid(\[cpr\], 7, 1)\>=0 and mid(\[cpr\], 7, 1)\<=3,19, if(mid(\[cpr\], 5, 2)\>=0 and mid(\[cpr\], 5, 2)\<=36 and mid(\[cpr\], 7, 1)\>=4 and mid(\[cpr\], 7, 1)\<=4,20, if(mid(\[cpr\], 5, 2)\>=37 and mid(\[cpr\], 5, 2)\<=99 and mid(\[cpr\], 7, 1)\>=4 and mid(\[cpr\], 7, 1)\<=4,19, if(mid(\[cpr\], 5, 2)\>=0 and mid(\[cpr\], 5, 2)\<=57 and mid(\[cpr\], 7, 1)\>=5 and mid(\[cpr\], 7, 1)\<=5,20, if(mid(\[cpr\], 5, 2)\>=58 and mid(\[cpr\], 5, 2)\<=99 and mid(\[cpr\], 7, 1)\>=5 and mid(\[cpr\], 7, 1)\<=5,18, if(mid(\[cpr\], 5, 2)\>=0 and mid(\[cpr\], 5, 2)\<=57 and mid(\[cpr\], 7, 1)\>=6 and mid(\[cpr\], 7, 1)\<=6,20, if(mid(\[cpr\], 5, 2)\>=58 and mid(\[cpr\], 5, 2)\<=99 and mid(\[cpr\], 7, 1)\>=6 and mid(\[cpr\], 7, 1)\<=6,18, if(mid(\[cpr\], 5, 2)\>=0 and mid(\[cpr\], 5, 2)\<=57 and mid(\[cpr\], 7, 1)\>=7 and mid(\[cpr\], 7, 1)\<=7,20, if(mid(\[cpr\], 5, 2)\>=58 and mid(\[cpr\], 5, 2)\<=99 and mid(\[cpr\], 7, 1)\>=7 and mid(\[cpr\], 7, 1)\<=7,18, if(mid(\[cpr\], 5, 2)\>=0 and mid(\[cpr\], 5, 2)\<=57 and mid(\[cpr\], 7, 1)\>=8 and mid(\[cpr\], 7, 1)\<=8,20, if(mid(\[cpr\], 5, 2)\>=58 and mid(\[cpr\], 5, 2)\<=99 and mid(\[cpr\], 7, 1)\>=8 and mid(\[cpr\], 7, 1)\<=8,18, if(mid(\[cpr\], 5, 2)\>=0 and mid(\[cpr\], 5, 2)\<=36 and mid(\[cpr\], 7, 1)\>=9 and mid(\[cpr\], 7, 1)\<=9,20, if(mid(\[cpr\], 5, 2)\>=37 and mid(\[cpr\], 5, 2)\<=99 and mid(\[cpr\], 7, 1)\>=9 and mid(\[cpr\], 7, 1)\<=9,19,17))))))))))))), mid(\[cpr\], 5, 2), "-",mid(\[cpr\],3, 2), "-", left(\[cpr\], 2) ), "")) |
| age | baseline_data_start | NA | calc | Age Note: Apparently, the build in datediff() function does not handle counting whole years. This results in wrongly counting age higher around the date of birth. | if(\[cpr\]!="" and \[inclusion\]!="", datediff(\[dob\], \[inclusion\], 'y'), "") | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA |
| age_integer | baseline_data_start | NA | calc | Age integer Note: as opposed to the build in datediff() this handles counting years as integers very well. Calculate decimal years in statistical programming software. In R you can use with(ds, stRoke::age_calc(dob, inclusion)). | if(\[cpr\]!="", left(\[inclusion\], 4)-left(\[dob\], 4) - if(mid(\[dob\], 6, 2) \< mid(\[inclusion\], 6, 2) or (mid(\[dob\], 6, 2) = mid(\[inclusion\], 6, 2) and mid(\[dob\], 9, 2) \<= mid(\[inclusion\], 9, 2)), 0, 1),"") | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA |
| sex | baseline_data_start | NA | text | Legal sex | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | @CALCTEXT(if(\[cpr\]!="",if((right(\[cpr\],1)=1 or right(\[cpr\],1)=3 or right(\[cpr\],1)=5 or right(\[cpr\],1)=7 or right(\[cpr\],1)=9),"male","female"),"")) |
| cohabitation | baseline_data_start | History and social | radio | Cohabitation | 1, Yes \| 2, No | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA |
| hypertension | baseline_data_start | NA | radio | Hypertension | 1, Yes \| 2, No | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA |
| diabetes | baseline_data_start | NA | radio | Diabetes | 1, Yes \| 2, No | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA |
| region | baseline_data_start | Area | dropdown | Region | 1, North \| 2, East \| 3, South \| 4, West | NA | autocomplete | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA |
| mrs_assessed | mrs | NA | radio | Assesed | 1, Yes \| 2, No | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA |
| mrs_date | mrs | NA | text | Assessment date | NA | NA | date_dmy | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA |
| mrs_score | mrs | NA | radio | mRS score | 0, 0 \| 1, 1 \| 2, 2 \| 3, 3 \| 4, 4 \| 5, 5 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA |
| con_event_note | consensus | NA | descriptive | \[follow1_arm_1\]\[event_type\]\[1\] : \[follow1_arm_1\]\[event_type\]\[2\] | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA |
| con_mrs | consensus | NA | text | Same event type | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | @IF('\[follow1_arm_1\]\[event_type\]\[1\]'='\[follow1_arm_1\]\[event_type\]\[2\]',@DEFAULT='pass',@DEFAULT="fail") |
| con_calc | consensus | NA | text | calc | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | @CALCTEXT(if(\[follow1_arm_1\]\[event_type\]\[1\]=\[follow1_arm_1\]\[event_type\]\[2\],\[follow1_arm_1\]\[event_type\]\[1\],"fail")) |
| event_datetime | new_event | NA | text | Time of event | NA | NA | datetime_seconds_ymd | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA |
| event_age | new_event | NA | calc | Age at event | if(\[event_datetime\]!="", left(\[event_datetime\], 4)-left(\[inclusion_arm_1\]\[dob\], 4) - if(mid(\[inclusion_arm_1\]\[dob\], 6, 2) \< mid(\[event_datetime\], 6, 2) or (mid(\[inclusion_arm_1\]\[dob\], 6, 2) = mid(\[event_datetime\], 6, 2) and mid(\[inclusion_arm_1\]\[dob\], 9, 2) \<= mid(\[event_datetime\], 9, 2)), 0, 1),"") | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA |
| event_type | new_event | NA | radio | Neurovascular event | 1, TIA \| 2, AIS \| 3, ICH \| 4, SAH \| 99, Unknown | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA |
To save the metadata as labels in the dataset, we can save field labels
and the choices from radio buttons and dropdown features:
``` r
labelled_data <-
apply_field_label(
data = redcapcast_data,
meta = redcapcast_meta
) |>
apply_factor_labels(meta = redcapcast_meta)
```
The `REDCap_split` function splits the data set into a list of
data.frames.
``` r
list <-
REDCap_split(
records = labelled_data,
metadata = redcapcast_meta,
forms = "all"
) |>
# Next steps cleans up and removes generic columns
sanitize_split()
str(list)
#> List of 3
#> $ baseline_data_start: tibble [6 × 14] (S3: tbl_df/tbl/data.frame)
#> ..$ record_id : num [1:6] 1 2 3 4 5 6
#> .. ..- attr(*, "label")= chr "ID"
#> ..$ redcap_event_name : chr [1:6] "inclusion" "inclusion" "inclusion" "inclusion" ...
#> ..$ cpr : chr [1:6] "1203401OB4" "0102342303" "2301569823" "0204051342" ...
#> .. ..- attr(*, "label")= chr "CPR (Danish civil registration number)"
#> ..$ inclusion : Date[1:6], format: "2023-03-13" "2023-03-01" ...
#> ..$ inclusion_time : 'hms' num [1:6] 12:38:49 10:38:57 12:01:07 20:39:19 ...
#> .. ..- attr(*, "units")= chr "secs"
#> ..$ dob : Date[1:6], format: "1940-03-12" "1934-02-01" ...
#> ..$ age : num [1:6] 83 89.1 66.1 117.9 126.2 ...
#> .. ..- attr(*, "label")= chr "Age\r\nNote: Apparently, the build in datediff() function does not handle counting whole years. This results in"| __truncated__
#> ..$ age_integer : num [1:6] 83 89 66 117 126 91
#> .. ..- attr(*, "label")= chr "Age integer\r\nNote: as opposed to the build in datediff() this handles counting years as integers very well. C"| __truncated__
#> ..$ sex : chr [1:6] "female" "male" "male" "female" ...
#> .. ..- attr(*, "label")= chr "Legal sex"
#> ..$ cohabitation : 'labelled' chr [1:6] "Yes" "Yes" "No" NA ...
#> .. ..- attr(*, "label")= chr "Cohabitation"
#> .. ..- attr(*, "labels")= Named chr [1:2] "1" "2"
#> .. .. ..- attr(*, "names")= chr [1:2] "Yes" "No"
#> ..$ hypertension : 'labelled' chr [1:6] "No" "No" "Yes" NA ...
#> .. ..- attr(*, "label")= chr "Hypertension"
#> .. ..- attr(*, "labels")= Named chr [1:2] "1" "2"
#> .. .. ..- attr(*, "names")= chr [1:2] "Yes" "No"
#> ..$ diabetes : 'labelled' chr [1:6] "Yes" "No" "Yes" NA ...
#> .. ..- attr(*, "label")= chr "Diabetes"
#> .. ..- attr(*, "labels")= Named chr [1:2] "1" "2"
#> .. .. ..- attr(*, "names")= chr [1:2] "Yes" "No"
#> ..$ region : 'labelled' chr [1:6] "East" "South" "North" NA ...
#> .. ..- attr(*, "label")= chr "Region"
#> .. ..- attr(*, "labels")= Named chr [1:4] "1" "2" "3" "4"
#> .. .. ..- attr(*, "names")= chr [1:4] "North" "East" "South" "West"
#> ..$ baseline_data_start_complete: chr [1:6] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...
#> $ mrs : tibble [5 × 6] (S3: tbl_df/tbl/data.frame)
#> ..$ record_id : num [1:5] 1 2 2 3 3
#> .. ..- attr(*, "label")= chr "ID"
#> ..$ redcap_event_name: chr [1:5] "inclusion" "inclusion" "follow1" "follow1" ...
#> ..$ mrs_assessed : 'labelled' chr [1:5] "Yes" "Yes" "Yes" "Yes" ...
#> .. ..- attr(*, "label")= chr "Assesed"
#> .. ..- attr(*, "labels")= Named chr [1:2] "1" "2"
#> .. .. ..- attr(*, "names")= chr [1:2] "Yes" "No"
#> ..$ mrs_date : Date[1:5], format: "2023-03-13" "2023-03-07" ...
#> ..$ mrs_score : 'labelled' num [1:5] 1 1 3 2 1
#> .. ..- attr(*, "label")= chr "mRS score"
#> .. ..- attr(*, "labels")= Named chr [1:6] "0" "1" "2" "3" ...
#> .. .. ..- attr(*, "names")= chr [1:6] "0" "1" "2" "3" ...
#> ..$ mrs_complete : chr [1:5] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...
#> $ new_event : tibble [13 × 8] (S3: tbl_df/tbl/data.frame)
#> ..$ record_id : num [1:13] 2 3 3 3 3 3 4 4 4 4 ...
#> .. ..- attr(*, "label")= chr "ID"
#> ..$ redcap_event_name : chr [1:13] "follow1" "follow1" "follow1" "follow2" ...
#> ..$ redcap_repeat_instrument: chr [1:13] "new_event" "new_event" "new_event" "new_event" ...
#> ..$ redcap_repeat_instance : num [1:13] 1 1 2 1 2 3 1 2 1 2 ...
#> ..$ event_datetime : POSIXct[1:13], format: "2024-01-18 12:49:42" "2024-01-18 12:49:58" ...
#> ..$ event_age : num [1:13] NA NA NA NA NA NA 96 105 118 118 ...
#> .. ..- attr(*, "label")= chr "Age at event"
#> ..$ event_type : 'labelled' chr [1:13] "TIA" "AIS" "ICH" "ICH" ...
#> .. ..- attr(*, "label")= chr "Neurovascular event"
#> .. ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...
#> .. .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...
#> ..$ new_event_complete : chr [1:13] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...
```
The
[`easy_redcap()`](https://agdamsbo.github.io/REDCapCAST/reference/easy_redcap.md)
will then (optionally) continue to widen the data, by transforming the
list of data.frames to a single data.frame with one row for each
subject/record_id (wide data format):
``` r
wide_data <- redcap_wider(list,
event.glue = "{.value}____{redcap_event_name}",
inst.glue = "{.value}____{redcap_repeat_instance}"
)
#> Joining with `by = join_by(record_id)`
#> Joining with `by = join_by(record_id)`
wide_data |> str()
#> tibble [6 × 49] (S3: tbl_df/tbl/data.frame)
#> $ record_id : num [1:6] 1 2 3 4 5 6
#> ..- attr(*, "label")= chr "ID"
#> $ cpr : chr [1:6] "1203401OB4" "0102342303" "2301569823" "0204051342" ...
#> ..- attr(*, "label")= chr "CPR (Danish civil registration number)"
#> $ inclusion : Date[1:6], format: "2023-03-13" "2023-03-01" ...
#> $ inclusion_time : 'hms' num [1:6] 12:38:49 10:38:57 12:01:07 20:39:19 ...
#> ..- attr(*, "units")= chr "secs"
#> $ dob : Date[1:6], format: "1940-03-12" "1934-02-01" ...
#> $ age : num [1:6] 83 89.1 66.1 117.9 126.2 ...
#> ..- attr(*, "label")= chr "Age\r\nNote: Apparently, the build in datediff() function does not handle counting whole years. This results in"| __truncated__
#> $ age_integer : num [1:6] 83 89 66 117 126 91
#> ..- attr(*, "label")= chr "Age integer\r\nNote: as opposed to the build in datediff() this handles counting years as integers very well. C"| __truncated__
#> $ sex : chr [1:6] "female" "male" "male" "female" ...
#> ..- attr(*, "label")= chr "Legal sex"
#> $ cohabitation : 'labelled' chr [1:6] "Yes" "Yes" "No" NA ...
#> ..- attr(*, "label")= chr "Cohabitation"
#> ..- attr(*, "labels")= Named chr [1:2] "1" "2"
#> .. ..- attr(*, "names")= chr [1:2] "Yes" "No"
#> $ hypertension : 'labelled' chr [1:6] "No" "No" "Yes" NA ...
#> ..- attr(*, "label")= chr "Hypertension"
#> ..- attr(*, "labels")= Named chr [1:2] "1" "2"
#> .. ..- attr(*, "names")= chr [1:2] "Yes" "No"
#> $ diabetes : 'labelled' chr [1:6] "Yes" "No" "Yes" NA ...
#> ..- attr(*, "label")= chr "Diabetes"
#> ..- attr(*, "labels")= Named chr [1:2] "1" "2"
#> .. ..- attr(*, "names")= chr [1:2] "Yes" "No"
#> $ region : 'labelled' chr [1:6] "East" "South" "North" NA ...
#> ..- attr(*, "label")= chr "Region"
#> ..- attr(*, "labels")= Named chr [1:4] "1" "2" "3" "4"
#> .. ..- attr(*, "names")= chr [1:4] "North" "East" "South" "West"
#> $ baseline_data_start_complete : chr [1:6] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...
#> $ mrs_assessed____inclusion : 'labelled' chr [1:6] "Yes" "Yes" NA NA ...
#> ..- attr(*, "label")= chr "Assesed"
#> ..- attr(*, "labels")= Named chr [1:2] "1" "2"
#> .. ..- attr(*, "names")= chr [1:2] "Yes" "No"
#> $ mrs_assessed____follow1 : 'labelled' chr [1:6] NA "Yes" "Yes" NA ...
#> ..- attr(*, "label")= chr "Assesed"
#> ..- attr(*, "labels")= Named chr [1:2] "1" "2"
#> .. ..- attr(*, "names")= chr [1:2] "Yes" "No"
#> $ mrs_assessed____follow2 : 'labelled' chr [1:6] NA NA "Yes" NA ...
#> ..- attr(*, "label")= chr "Assesed"
#> ..- attr(*, "labels")= Named chr [1:2] "1" "2"
#> .. ..- attr(*, "names")= chr [1:2] "Yes" "No"
#> $ mrs_date____inclusion : Date[1:6], format: "2023-03-13" "2023-03-07" ...
#> $ mrs_date____follow1 : Date[1:6], format: NA "2023-03-09" ...
#> $ mrs_date____follow2 : Date[1:6], format: NA NA ...
#> $ mrs_score____inclusion : 'labelled' num [1:6] 1 1 NA NA NA NA
#> ..- attr(*, "label")= chr "mRS score"
#> ..- attr(*, "labels")= Named chr [1:6] "0" "1" "2" "3" ...
#> .. ..- attr(*, "names")= chr [1:6] "0" "1" "2" "3" ...
#> $ mrs_score____follow1 : 'labelled' num [1:6] NA 3 2 NA NA NA
#> ..- attr(*, "label")= chr "mRS score"
#> ..- attr(*, "labels")= Named chr [1:6] "0" "1" "2" "3" ...
#> .. ..- attr(*, "names")= chr [1:6] "0" "1" "2" "3" ...
#> $ mrs_score____follow2 : 'labelled' num [1:6] NA NA 1 NA NA NA
#> ..- attr(*, "label")= chr "mRS score"
#> ..- attr(*, "labels")= Named chr [1:6] "0" "1" "2" "3" ...
#> .. ..- attr(*, "names")= chr [1:6] "0" "1" "2" "3" ...
#> $ mrs_complete____inclusion : chr [1:6] "Incomplete" "Incomplete" NA NA ...
#> $ mrs_complete____follow1 : chr [1:6] NA "Incomplete" "Incomplete" NA ...
#> $ mrs_complete____follow2 : chr [1:6] NA NA "Incomplete" NA ...
#> $ event_datetime____1____follow1 : POSIXct[1:6], format: NA "2024-01-18 12:49:42" ...
#> $ event_datetime____1____follow2 : POSIXct[1:6], format: NA NA ...
#> $ event_age____1____follow1 : num [1:6] NA NA NA 96 127 NA
#> ..- attr(*, "label")= chr "Age at event"
#> $ event_age____1____follow2 : num [1:6] NA NA NA 118 NA NA
#> ..- attr(*, "label")= chr "Age at event"
#> $ event_type____1____follow1 : 'labelled' chr [1:6] NA "TIA" "AIS" "TIA" ...
#> ..- attr(*, "label")= chr "Neurovascular event"
#> ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...
#> .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...
#> $ event_type____1____follow2 : 'labelled' chr [1:6] NA NA "ICH" "AIS" ...
#> ..- attr(*, "label")= chr "Neurovascular event"
#> ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...
#> .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...
#> $ new_event_complete____1____follow1: chr [1:6] NA "Incomplete" "Incomplete" "Complete" ...
#> $ new_event_complete____1____follow2: chr [1:6] NA NA "Incomplete" "Complete" ...
#> $ event_datetime____2____follow1 : POSIXct[1:6], format: NA NA ...
#> $ event_datetime____2____follow2 : POSIXct[1:6], format: NA NA ...
#> $ event_datetime____3____follow1 : POSIXct[1:6], format: NA NA ...
#> $ event_datetime____3____follow2 : POSIXct[1:6], format: NA NA ...
#> $ event_age____2____follow1 : num [1:6] NA NA NA 105 127 NA
#> ..- attr(*, "label")= chr "Age at event"
#> $ event_age____2____follow2 : num [1:6] NA NA NA 118 NA NA
#> ..- attr(*, "label")= chr "Age at event"
#> $ event_age____3____follow1 : num [1:6] NA NA NA NA NA NA
#> ..- attr(*, "label")= chr "Age at event"
#> $ event_age____3____follow2 : num [1:6] NA NA NA 118 NA NA
#> ..- attr(*, "label")= chr "Age at event"
#> $ event_type____2____follow1 : 'labelled' chr [1:6] NA NA "ICH" "TIA" ...
#> ..- attr(*, "label")= chr "Neurovascular event"
#> ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...
#> .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...
#> $ event_type____2____follow2 : 'labelled' chr [1:6] NA NA "TIA" "ICH" ...
#> ..- attr(*, "label")= chr "Neurovascular event"
#> ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...
#> .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...
#> $ event_type____3____follow1 : 'labelled' chr [1:6] NA NA NA NA ...
#> ..- attr(*, "label")= chr "Neurovascular event"
#> ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...
#> .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...
#> $ event_type____3____follow2 : 'labelled' chr [1:6] NA NA "AIS" "Unknown" ...
#> ..- attr(*, "label")= chr "Neurovascular event"
#> ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...
#> .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...
#> $ new_event_complete____2____follow1: chr [1:6] NA NA "Incomplete" "Complete" ...
#> $ new_event_complete____2____follow2: chr [1:6] NA NA "Incomplete" "Incomplete" ...
#> $ new_event_complete____3____follow1: chr [1:6] NA NA NA NA ...
#> $ new_event_complete____3____follow2: chr [1:6] NA NA "Incomplete" "Complete" ...
```
Transfer suffixes to labels:
``` r
wide_data_suffixes <- wide_data |> suffix2label()
```
## Creating a nice table
``` r
wide_data_suffixes |>
as_factor()|>
dplyr::select(sex, hypertension, diabetes,mrs_score____follow2) |>
gtsummary::tbl_summary(type = gtsummary::all_dichotomous() ~ "categorical")
```
[TABLE]

View file

@ -1,17 +1,16 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Shiny-app • REDCapCAST</title> <title>Shiny-app • REDCapCAST</title>
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"> <!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png">
<link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"> <link rel="icon" type="”image/svg+xml”" href="../favicon.svg">
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"> <link rel="apple-touch-icon" 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="icon" sizes="any" href="../favicon.ico">
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"> <link rel="manifest" href="../site.webmanifest">
<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"> <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"> <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"> <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">
@ -26,7 +25,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -67,7 +66,7 @@
<h1>Shiny-app</h1> <h1>Shiny-app</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/vignettes/Shiny-app.Rmd" class="external-link"><code>vignettes/Shiny-app.Rmd</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/vignettes/Shiny-app.Rmd" class="external-link"><code>vignettes/Shiny-app.Rmd</code></a></small>
<div class="d-none name"><code>Shiny-app.Rmd</code></div> <div class="d-none name"><code>Shiny-app.Rmd</code></div>
</div> </div>
@ -151,55 +150,55 @@ and launch the app as follows:</p>
<span> <span class="fu">purrr</span><span class="fu">::</span><span class="fu"><a href="https://purrr.tidyverse.org/reference/pluck.html" class="external-link">pluck</a></span><span class="op">(</span><span class="st">"data"</span><span class="op">)</span> <span class="op">|&gt;</span> </span> <span> <span class="fu">purrr</span><span class="fu">::</span><span class="fu"><a href="https://purrr.tidyverse.org/reference/pluck.html" class="external-link">pluck</a></span><span class="op">(</span><span class="st">"data"</span><span class="op">)</span> <span class="op">|&gt;</span> </span>
<span> <span class="fu"><a href="https://rdrr.io/r/utils/str.html" class="external-link">str</a></span><span class="op">(</span><span class="op">)</span></span> <span> <span class="fu"><a href="https://rdrr.io/r/utils/str.html" class="external-link">str</a></span><span class="op">(</span><span class="op">)</span></span>
<span><span class="co">#&gt; tibble [6 × 49] (S3: tbl_df/tbl/data.frame)</span></span> <span><span class="co">#&gt; tibble [6 × 49] (S3: tbl_df/tbl/data.frame)</span></span>
<span><span class="co">#&gt; $ record_id : num [1:6] 1 2 3 4 5 6</span></span> <span><span class="co">#&gt; $ record_id : num [1:6] 1 2 3 4 5 6</span></span>
<span><span class="co">#&gt; $ cpr : chr [1:6] "1203401OB4" "0102342303" "2301569823" "0204051342" ...</span></span> <span><span class="co">#&gt; $ cpr : chr [1:6] "1203401OB4" "0102342303" "2301569823" "0204051342" ...</span></span>
<span><span class="co">#&gt; $ inclusion : Date[1:6], format: "2023-03-13" "2023-03-01" ...</span></span> <span><span class="co">#&gt; $ inclusion : Date[1:6], format: "2023-03-13" "2023-03-01" ...</span></span>
<span><span class="co">#&gt; $ inclusion_time : chr [1:6] "12:38:49" "10:38:57" "12:01:07" "20:39:19" ...</span></span> <span><span class="co">#&gt; $ inclusion_time : chr [1:6] "12:38:49" "10:38:57" "12:01:07" "20:39:19" ...</span></span>
<span><span class="co">#&gt; $ dob : Date[1:6], format: "1940-03-12" "1934-02-01" ...</span></span> <span><span class="co">#&gt; $ dob : Date[1:6], format: "1940-03-12" "1934-02-01" ...</span></span>
<span><span class="co">#&gt; $ age : num [1:6] 83 89.1 66.1 117.9 126.2 ...</span></span> <span><span class="co">#&gt; $ age : num [1:6] 83 89.1 66.1 117.9 126.2 ...</span></span>
<span><span class="co">#&gt; $ age_integer : num [1:6] 83 89 66 117 126 91</span></span> <span><span class="co">#&gt; $ age_integer : num [1:6] 83 89 66 117 126 91</span></span>
<span><span class="co">#&gt; $ sex : chr [1:6] "female" "male" "male" "female" ...</span></span> <span><span class="co">#&gt; $ sex : chr [1:6] "female" "male" "male" "female" ...</span></span>
<span><span class="co">#&gt; $ cohabitation : chr [1:6] "Yes" "Yes" "No" NA ...</span></span> <span><span class="co">#&gt; $ cohabitation : chr [1:6] "Yes" "Yes" "No" NA ...</span></span>
<span><span class="co">#&gt; $ hypertension : chr [1:6] "No" "No" "Yes" NA ...</span></span> <span><span class="co">#&gt; $ hypertension : chr [1:6] "No" "No" "Yes" NA ...</span></span>
<span><span class="co">#&gt; $ diabetes : chr [1:6] "Yes" "No" "Yes" NA ...</span></span> <span><span class="co">#&gt; $ diabetes : chr [1:6] "Yes" "No" "Yes" NA ...</span></span>
<span><span class="co">#&gt; $ region : chr [1:6] "East" "South" "North" NA ...</span></span> <span><span class="co">#&gt; $ region : chr [1:6] "East" "South" "North" NA ...</span></span>
<span><span class="co">#&gt; $ baseline_data_start_complete : chr [1:6] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...</span></span> <span><span class="co">#&gt; $ baseline_data_start_complete : chr [1:6] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...</span></span>
<span><span class="co">#&gt; $ mrs_assessed____inclusion : chr [1:6] "Yes" "Yes" NA NA ...</span></span> <span><span class="co">#&gt; $ mrs_assessed__inclusion : chr [1:6] "Yes" "Yes" NA NA ...</span></span>
<span><span class="co">#&gt; $ mrs_assessed____follow1 : chr [1:6] NA "Yes" "Yes" NA ...</span></span> <span><span class="co">#&gt; $ mrs_assessed__follow1 : chr [1:6] NA "Yes" "Yes" NA ...</span></span>
<span><span class="co">#&gt; $ mrs_assessed____follow2 : chr [1:6] NA NA "Yes" NA ...</span></span> <span><span class="co">#&gt; $ mrs_assessed__follow2 : chr [1:6] NA NA "Yes" NA ...</span></span>
<span><span class="co">#&gt; $ mrs_date____inclusion : Date[1:6], format: "2023-03-13" "2023-03-07" ...</span></span> <span><span class="co">#&gt; $ mrs_date__inclusion : Date[1:6], format: "2023-03-13" "2023-03-07" ...</span></span>
<span><span class="co">#&gt; $ mrs_date____follow1 : Date[1:6], format: NA "2023-03-09" ...</span></span> <span><span class="co">#&gt; $ mrs_date__follow1 : Date[1:6], format: NA "2023-03-09" ...</span></span>
<span><span class="co">#&gt; $ mrs_date____follow2 : Date[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ mrs_date__follow2 : Date[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ mrs_score____inclusion : num [1:6] 1 1 NA NA NA NA</span></span> <span><span class="co">#&gt; $ mrs_score__inclusion : num [1:6] 1 1 NA NA NA NA</span></span>
<span><span class="co">#&gt; $ mrs_score____follow1 : num [1:6] NA 3 2 NA NA NA</span></span> <span><span class="co">#&gt; $ mrs_score__follow1 : num [1:6] NA 3 2 NA NA NA</span></span>
<span><span class="co">#&gt; $ mrs_score____follow2 : num [1:6] NA NA 1 NA NA NA</span></span> <span><span class="co">#&gt; $ mrs_score__follow2 : num [1:6] NA NA 1 NA NA NA</span></span>
<span><span class="co">#&gt; $ mrs_complete____inclusion : chr [1:6] "Incomplete" "Incomplete" NA NA ...</span></span> <span><span class="co">#&gt; $ mrs_complete__inclusion : chr [1:6] "Incomplete" "Incomplete" NA NA ...</span></span>
<span><span class="co">#&gt; $ mrs_complete____follow1 : chr [1:6] NA "Incomplete" "Incomplete" NA ...</span></span> <span><span class="co">#&gt; $ mrs_complete__follow1 : chr [1:6] NA "Incomplete" "Incomplete" NA ...</span></span>
<span><span class="co">#&gt; $ mrs_complete____follow2 : chr [1:6] NA NA "Incomplete" NA ...</span></span> <span><span class="co">#&gt; $ mrs_complete__follow2 : chr [1:6] NA NA "Incomplete" NA ...</span></span>
<span><span class="co">#&gt; $ event_datetime____1____follow1 : POSIXct[1:6], format: NA "2024-01-18 12:49:42" ...</span></span> <span><span class="co">#&gt; $ event_datetime__1__follow1 : POSIXct[1:6], format: NA "2024-01-18 12:49:42" ...</span></span>
<span><span class="co">#&gt; $ event_datetime____1____follow2 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime__1__follow2 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_age____1____follow1 : num [1:6] NA NA NA 96 127 NA</span></span> <span><span class="co">#&gt; $ event_age__1__follow1 : num [1:6] NA NA NA 96 127 NA</span></span>
<span><span class="co">#&gt; $ event_age____1____follow2 : num [1:6] NA NA NA 118 NA NA</span></span> <span><span class="co">#&gt; $ event_age__1__follow2 : num [1:6] NA NA NA 118 NA NA</span></span>
<span><span class="co">#&gt; $ event_type____1____follow1 : chr [1:6] NA "TIA" "AIS" "TIA" ...</span></span> <span><span class="co">#&gt; $ event_type__1__follow1 : chr [1:6] NA "TIA" "AIS" "TIA" ...</span></span>
<span><span class="co">#&gt; $ event_type____1____follow2 : chr [1:6] NA NA "ICH" "AIS" ...</span></span> <span><span class="co">#&gt; $ event_type__1__follow2 : chr [1:6] NA NA "ICH" "AIS" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete____1____follow1: chr [1:6] NA "Incomplete" "Incomplete" "Complete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete__1__follow1: chr [1:6] NA "Incomplete" "Incomplete" "Complete" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete____1____follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete__1__follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span>
<span><span class="co">#&gt; $ event_datetime____2____follow1 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime__2__follow1 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_datetime____2____follow2 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime__2__follow2 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_datetime____3____follow1 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime__3__follow1 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_datetime____3____follow2 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime__3__follow2 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_age____2____follow1 : num [1:6] NA NA NA 105 127 NA</span></span> <span><span class="co">#&gt; $ event_age__2__follow1 : num [1:6] NA NA NA 105 127 NA</span></span>
<span><span class="co">#&gt; $ event_age____2____follow2 : num [1:6] NA NA NA 118 NA NA</span></span> <span><span class="co">#&gt; $ event_age__2__follow2 : num [1:6] NA NA NA 118 NA NA</span></span>
<span><span class="co">#&gt; $ event_age____3____follow1 : num [1:6] NA NA NA NA NA NA</span></span> <span><span class="co">#&gt; $ event_age__3__follow1 : num [1:6] NA NA NA NA NA NA</span></span>
<span><span class="co">#&gt; $ event_age____3____follow2 : num [1:6] NA NA NA 118 NA NA</span></span> <span><span class="co">#&gt; $ event_age__3__follow2 : num [1:6] NA NA NA 118 NA NA</span></span>
<span><span class="co">#&gt; $ event_type____2____follow1 : chr [1:6] NA NA "ICH" "TIA" ...</span></span> <span><span class="co">#&gt; $ event_type__2__follow1 : chr [1:6] NA NA "ICH" "TIA" ...</span></span>
<span><span class="co">#&gt; $ event_type____2____follow2 : chr [1:6] NA NA "TIA" "ICH" ...</span></span> <span><span class="co">#&gt; $ event_type__2__follow2 : chr [1:6] NA NA "TIA" "ICH" ...</span></span>
<span><span class="co">#&gt; $ event_type____3____follow1 : chr [1:6] NA NA NA NA ...</span></span> <span><span class="co">#&gt; $ event_type__3__follow1 : chr [1:6] NA NA NA NA ...</span></span>
<span><span class="co">#&gt; $ event_type____3____follow2 : chr [1:6] NA NA "AIS" "Unknown" ...</span></span> <span><span class="co">#&gt; $ event_type__3__follow2 : chr [1:6] NA NA "AIS" "Unknown" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete____2____follow1: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete__2__follow1: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete____2____follow2: chr [1:6] NA NA "Incomplete" "Incomplete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete__2__follow2: chr [1:6] NA NA "Incomplete" "Incomplete" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete____3____follow1: chr [1:6] NA NA NA NA ...</span></span> <span><span class="co">#&gt; $ new_event_complete__3__follow1: chr [1:6] NA NA NA NA ...</span></span>
<span><span class="co">#&gt; $ new_event_complete____3____follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span></code></pre></div> <span><span class="co">#&gt; $ new_event_complete__3__follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span></code></pre></div>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">ds</span><span class="op">|&gt;</span> </span> <code class="sourceCode R"><span><span class="va">ds</span><span class="op">|&gt;</span> </span>
<span> <span class="fu"><a href="../reference/ds2dd_detailed.html">ds2dd_detailed</a></span><span class="op">(</span>metadata <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="fu">REDCapCAST</span><span class="fu">::</span><span class="va"><a href="../reference/redcapcast_meta.html">redcapcast_meta</a></span><span class="op">)</span><span class="op">)</span><span class="op">|&gt;</span> </span> <span> <span class="fu"><a href="../reference/ds2dd_detailed.html">ds2dd_detailed</a></span><span class="op">(</span>metadata <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="fu">REDCapCAST</span><span class="fu">::</span><span class="va"><a href="../reference/redcapcast_meta.html">redcapcast_meta</a></span><span class="op">)</span><span class="op">)</span><span class="op">|&gt;</span> </span>
@ -379,7 +378,7 @@ based on a set threshold for unique values:</p>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer> </footer>

323
articles/Shiny-app.md Normal file
View file

@ -0,0 +1,323 @@
# Shiny-app
To make the easiest possible transition from spreadsheet/dataset to
REDCap, I have created a small app, which adds a graphical interface to
the casting of a data dictionary and data upload. Install the package
and launch the app as follows:
``` r
REDCapCAST::shiny_cast()
```
The app primarily wraps one function:
[`ds2dd_detailed()`](https://agdamsbo.github.io/REDCapCAST/reference/ds2dd_detailed.md).
``` r
library(REDCapCAST)
ds <- REDCap_split(
records = redcapcast_data,
metadata = redcapcast_meta,
forms = "all"
) |>
sanitize_split() |>
redcap_wider()
#> Joining with `by = join_by(record_id)`
#> Joining with `by = join_by(record_id)`
str(ds)
#> tibble [6 × 49] (S3: tbl_df/tbl/data.frame)
#> $ record_id : num [1:6] 1 2 3 4 5 6
#> $ cpr : chr [1:6] "1203401OB4" "0102342303" "2301569823" "0204051342" ...
#> $ inclusion : Date[1:6], format: "2023-03-13" "2023-03-01" ...
#> $ inclusion_time : 'hms' num [1:6] 12:38:49 10:38:57 12:01:07 20:39:19 ...
#> ..- attr(*, "units")= chr "secs"
#> $ dob : Date[1:6], format: "1940-03-12" "1934-02-01" ...
#> $ age : num [1:6] 83 89.1 66.1 117.9 126.2 ...
#> $ age_integer : num [1:6] 83 89 66 117 126 91
#> $ sex : chr [1:6] "female" "male" "male" "female" ...
#> $ cohabitation : chr [1:6] "Yes" "Yes" "No" NA ...
#> $ hypertension : chr [1:6] "No" "No" "Yes" NA ...
#> $ diabetes : chr [1:6] "Yes" "No" "Yes" NA ...
#> $ region : chr [1:6] "East" "South" "North" NA ...
#> $ baseline_data_start_complete : chr [1:6] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...
#> $ mrs_assessed____inclusion : chr [1:6] "Yes" "Yes" NA NA ...
#> $ mrs_assessed____follow1 : chr [1:6] NA "Yes" "Yes" NA ...
#> $ mrs_assessed____follow2 : chr [1:6] NA NA "Yes" NA ...
#> $ mrs_date____inclusion : Date[1:6], format: "2023-03-13" "2023-03-07" ...
#> $ mrs_date____follow1 : Date[1:6], format: NA "2023-03-09" ...
#> $ mrs_date____follow2 : Date[1:6], format: NA NA ...
#> $ mrs_score____inclusion : num [1:6] 1 1 NA NA NA NA
#> $ mrs_score____follow1 : num [1:6] NA 3 2 NA NA NA
#> $ mrs_score____follow2 : num [1:6] NA NA 1 NA NA NA
#> $ mrs_complete____inclusion : chr [1:6] "Incomplete" "Incomplete" NA NA ...
#> $ mrs_complete____follow1 : chr [1:6] NA "Incomplete" "Incomplete" NA ...
#> $ mrs_complete____follow2 : chr [1:6] NA NA "Incomplete" NA ...
#> $ event_datetime____1____follow1 : POSIXct[1:6], format: NA "2024-01-18 12:49:42" ...
#> $ event_datetime____1____follow2 : POSIXct[1:6], format: NA NA ...
#> $ event_age____1____follow1 : num [1:6] NA NA NA 96 127 NA
#> $ event_age____1____follow2 : num [1:6] NA NA NA 118 NA NA
#> $ event_type____1____follow1 : chr [1:6] NA "TIA" "AIS" "TIA" ...
#> $ event_type____1____follow2 : chr [1:6] NA NA "ICH" "AIS" ...
#> $ new_event_complete____1____follow1: chr [1:6] NA "Incomplete" "Incomplete" "Complete" ...
#> $ new_event_complete____1____follow2: chr [1:6] NA NA "Incomplete" "Complete" ...
#> $ event_datetime____2____follow1 : POSIXct[1:6], format: NA NA ...
#> $ event_datetime____2____follow2 : POSIXct[1:6], format: NA NA ...
#> $ event_datetime____3____follow1 : POSIXct[1:6], format: NA NA ...
#> $ event_datetime____3____follow2 : POSIXct[1:6], format: NA NA ...
#> $ event_age____2____follow1 : num [1:6] NA NA NA 105 127 NA
#> $ event_age____2____follow2 : num [1:6] NA NA NA 118 NA NA
#> $ event_age____3____follow1 : num [1:6] NA NA NA NA NA NA
#> $ event_age____3____follow2 : num [1:6] NA NA NA 118 NA NA
#> $ event_type____2____follow1 : chr [1:6] NA NA "ICH" "TIA" ...
#> $ event_type____2____follow2 : chr [1:6] NA NA "TIA" "ICH" ...
#> $ event_type____3____follow1 : chr [1:6] NA NA NA NA ...
#> $ event_type____3____follow2 : chr [1:6] NA NA "AIS" "Unknown" ...
#> $ new_event_complete____2____follow1: chr [1:6] NA NA "Incomplete" "Complete" ...
#> $ new_event_complete____2____follow2: chr [1:6] NA NA "Incomplete" "Incomplete" ...
#> $ new_event_complete____3____follow1: chr [1:6] NA NA NA NA ...
#> $ new_event_complete____3____follow2: chr [1:6] NA NA "Incomplete" "Complete" ...
#> - attr(*, "problems")=<externalptr>
```
``` r
ds|>
ds2dd_detailed(metadata = names(REDCapCAST::redcapcast_meta))|>
purrr::pluck("data") |>
str()
#> tibble [6 × 49] (S3: tbl_df/tbl/data.frame)
#> $ record_id : num [1:6] 1 2 3 4 5 6
#> $ cpr : chr [1:6] "1203401OB4" "0102342303" "2301569823" "0204051342" ...
#> $ inclusion : Date[1:6], format: "2023-03-13" "2023-03-01" ...
#> $ inclusion_time : chr [1:6] "12:38:49" "10:38:57" "12:01:07" "20:39:19" ...
#> $ dob : Date[1:6], format: "1940-03-12" "1934-02-01" ...
#> $ age : num [1:6] 83 89.1 66.1 117.9 126.2 ...
#> $ age_integer : num [1:6] 83 89 66 117 126 91
#> $ sex : chr [1:6] "female" "male" "male" "female" ...
#> $ cohabitation : chr [1:6] "Yes" "Yes" "No" NA ...
#> $ hypertension : chr [1:6] "No" "No" "Yes" NA ...
#> $ diabetes : chr [1:6] "Yes" "No" "Yes" NA ...
#> $ region : chr [1:6] "East" "South" "North" NA ...
#> $ baseline_data_start_complete : chr [1:6] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...
#> $ mrs_assessed__inclusion : chr [1:6] "Yes" "Yes" NA NA ...
#> $ mrs_assessed__follow1 : chr [1:6] NA "Yes" "Yes" NA ...
#> $ mrs_assessed__follow2 : chr [1:6] NA NA "Yes" NA ...
#> $ mrs_date__inclusion : Date[1:6], format: "2023-03-13" "2023-03-07" ...
#> $ mrs_date__follow1 : Date[1:6], format: NA "2023-03-09" ...
#> $ mrs_date__follow2 : Date[1:6], format: NA NA ...
#> $ mrs_score__inclusion : num [1:6] 1 1 NA NA NA NA
#> $ mrs_score__follow1 : num [1:6] NA 3 2 NA NA NA
#> $ mrs_score__follow2 : num [1:6] NA NA 1 NA NA NA
#> $ mrs_complete__inclusion : chr [1:6] "Incomplete" "Incomplete" NA NA ...
#> $ mrs_complete__follow1 : chr [1:6] NA "Incomplete" "Incomplete" NA ...
#> $ mrs_complete__follow2 : chr [1:6] NA NA "Incomplete" NA ...
#> $ event_datetime__1__follow1 : POSIXct[1:6], format: NA "2024-01-18 12:49:42" ...
#> $ event_datetime__1__follow2 : POSIXct[1:6], format: NA NA ...
#> $ event_age__1__follow1 : num [1:6] NA NA NA 96 127 NA
#> $ event_age__1__follow2 : num [1:6] NA NA NA 118 NA NA
#> $ event_type__1__follow1 : chr [1:6] NA "TIA" "AIS" "TIA" ...
#> $ event_type__1__follow2 : chr [1:6] NA NA "ICH" "AIS" ...
#> $ new_event_complete__1__follow1: chr [1:6] NA "Incomplete" "Incomplete" "Complete" ...
#> $ new_event_complete__1__follow2: chr [1:6] NA NA "Incomplete" "Complete" ...
#> $ event_datetime__2__follow1 : POSIXct[1:6], format: NA NA ...
#> $ event_datetime__2__follow2 : POSIXct[1:6], format: NA NA ...
#> $ event_datetime__3__follow1 : POSIXct[1:6], format: NA NA ...
#> $ event_datetime__3__follow2 : POSIXct[1:6], format: NA NA ...
#> $ event_age__2__follow1 : num [1:6] NA NA NA 105 127 NA
#> $ event_age__2__follow2 : num [1:6] NA NA NA 118 NA NA
#> $ event_age__3__follow1 : num [1:6] NA NA NA NA NA NA
#> $ event_age__3__follow2 : num [1:6] NA NA NA 118 NA NA
#> $ event_type__2__follow1 : chr [1:6] NA NA "ICH" "TIA" ...
#> $ event_type__2__follow2 : chr [1:6] NA NA "TIA" "ICH" ...
#> $ event_type__3__follow1 : chr [1:6] NA NA NA NA ...
#> $ event_type__3__follow2 : chr [1:6] NA NA "AIS" "Unknown" ...
#> $ new_event_complete__2__follow1: chr [1:6] NA NA "Incomplete" "Complete" ...
#> $ new_event_complete__2__follow2: chr [1:6] NA NA "Incomplete" "Incomplete" ...
#> $ new_event_complete__3__follow1: chr [1:6] NA NA NA NA ...
#> $ new_event_complete__3__follow2: chr [1:6] NA NA "Incomplete" "Complete" ...
```
``` r
ds|>
ds2dd_detailed(metadata = names(REDCapCAST::redcapcast_meta))|>
purrr::pluck("meta") |>
head(10)
#> # A tibble: 10 × 18
#> field_name form_name section_header field_type field_label
#> <chr> <chr> <lgl> <chr> <chr>
#> 1 record_id data NA text record_id
#> 2 cpr data NA text cpr
#> 3 inclusion data NA text inclusion
#> 4 inclusion_time data NA text inclusion_time
#> 5 dob data NA text dob
#> 6 age data NA text age
#> 7 age_integer data NA text age_integer
#> 8 sex data NA text sex
#> 9 cohabitation data NA text cohabitation
#> 10 hypertension data NA text hypertension
#> # 13 more variables: select_choices_or_calculations <lgl>, field_note <lgl>,
#> # text_validation_type_or_show_slider_number <chr>,
#> # text_validation_min <lgl>, text_validation_max <lgl>, identifier <lgl>,
#> # branching_logic <lgl>, required_field <lgl>, custom_alignment <lgl>,
#> # question_number <lgl>, matrix_group_name <lgl>, matrix_ranking <lgl>,
#> # field_annotation <lgl>
```
Different data formats are accepted, which all mostly implements the
[`readr::col_guess()`](https://readr.tidyverse.org/reference/parse_guess.html)
functionality to parse column classes.
To ensure uniformity in data import this parsing has been implemented on
its own to use with
[`ds2dd_detailed()`](https://agdamsbo.github.io/REDCapCAST/reference/ds2dd_detailed.md)
or any other data set for that matter:
``` r
ds_parsed <- redcapcast_data |>
dplyr::mutate(dplyr::across(dplyr::everything(),as.character)) |>
parse_data()
str(ds_parsed)
#> tibble [25 × 27] (S3: tbl_df/tbl/data.frame)
#> $ record_id : num [1:25] 1 2 2 2 3 3 3 3 3 3 ...
#> $ redcap_event_name : chr [1:25] "inclusion" "inclusion" "follow1" "follow1" ...
#> $ redcap_repeat_instrument : chr [1:25] NA NA NA "New Event (?)" ...
#> $ redcap_repeat_instance : num [1:25] NA NA NA 1 NA NA NA 1 2 1 ...
#> $ cpr : chr [1:25] "1203401OB4" "0102342303" NA NA ...
#> $ inclusion : Date[1:25], format: "2023-03-13" "2023-03-01" ...
#> $ inclusion_time : 'hms' num [1:25] 12:38:49 10:38:57 NA NA ...
#> ..- attr(*, "units")= chr "secs"
#> $ dob : Date[1:25], format: "1940-03-12" "1934-02-01" ...
#> $ age : num [1:25] 83 89.1 NA NA 66.1 ...
#> $ age_integer : num [1:25] 83 89 NA NA 66 NA NA NA NA NA ...
#> $ sex : chr [1:25] "female" "male" NA NA ...
#> $ cohabitation : chr [1:25] "Yes" "Yes" NA NA ...
#> $ hypertension : chr [1:25] "No" "No" NA NA ...
#> $ diabetes : chr [1:25] "Yes" "No" NA NA ...
#> $ region : chr [1:25] "East" "South" NA NA ...
#> $ baseline_data_start_complete: chr [1:25] "Incomplete" "Incomplete" NA NA ...
#> $ mrs_assessed : chr [1:25] "Yes" "Yes" "Yes" NA ...
#> $ mrs_date : Date[1:25], format: "2023-03-13" "2023-03-07" ...
#> $ mrs_score : num [1:25] 1 1 3 NA NA 2 1 NA NA NA ...
#> $ mrs_complete : chr [1:25] "Incomplete" "Incomplete" "Incomplete" NA ...
#> $ con_mrs : logi [1:25] NA NA NA NA NA NA ...
#> $ con_calc : logi [1:25] NA NA NA NA NA NA ...
#> $ consensus_complete : chr [1:25] NA NA "Incomplete" NA ...
#> $ event_datetime : POSIXct[1:25], format: NA NA ...
#> $ event_age : num [1:25] NA NA NA NA NA NA NA NA NA NA ...
#> $ event_type : chr [1:25] NA NA NA "TIA" ...
#> $ new_event_complete : chr [1:25] NA NA NA "Incomplete" ...
#> - attr(*, "problems")=<externalptr>
```
It will ignore specified columns, which is neat for numeric-looking
strings like cpr-with a leading 0:
``` r
redcapcast_data |>
dplyr::mutate(dplyr::across(dplyr::everything(),as.character)) |>
parse_data(ignore.vars = c("record_id","cpr")) |>
str()
#> tibble [25 × 27] (S3: tbl_df/tbl/data.frame)
#> $ record_id : chr [1:25] "1" "2" "2" "2" ...
#> $ redcap_event_name : chr [1:25] "inclusion" "inclusion" "follow1" "follow1" ...
#> $ redcap_repeat_instrument : chr [1:25] NA NA NA "New Event (?)" ...
#> $ redcap_repeat_instance : num [1:25] NA NA NA 1 NA NA NA 1 2 1 ...
#> $ cpr : chr [1:25] "1203401OB4" "0102342303" NA NA ...
#> $ inclusion : Date[1:25], format: "2023-03-13" "2023-03-01" ...
#> $ inclusion_time : 'hms' num [1:25] 12:38:49 10:38:57 NA NA ...
#> ..- attr(*, "units")= chr "secs"
#> $ dob : Date[1:25], format: "1940-03-12" "1934-02-01" ...
#> $ age : num [1:25] 83 89.1 NA NA 66.1 ...
#> $ age_integer : num [1:25] 83 89 NA NA 66 NA NA NA NA NA ...
#> $ sex : chr [1:25] "female" "male" NA NA ...
#> $ cohabitation : chr [1:25] "Yes" "Yes" NA NA ...
#> $ hypertension : chr [1:25] "No" "No" NA NA ...
#> $ diabetes : chr [1:25] "Yes" "No" NA NA ...
#> $ region : chr [1:25] "East" "South" NA NA ...
#> $ baseline_data_start_complete: chr [1:25] "Incomplete" "Incomplete" NA NA ...
#> $ mrs_assessed : chr [1:25] "Yes" "Yes" "Yes" NA ...
#> $ mrs_date : Date[1:25], format: "2023-03-13" "2023-03-07" ...
#> $ mrs_score : num [1:25] 1 1 3 NA NA 2 1 NA NA NA ...
#> $ mrs_complete : chr [1:25] "Incomplete" "Incomplete" "Incomplete" NA ...
#> $ con_mrs : logi [1:25] NA NA NA NA NA NA ...
#> $ con_calc : logi [1:25] NA NA NA NA NA NA ...
#> $ consensus_complete : chr [1:25] NA NA "Incomplete" NA ...
#> $ event_datetime : POSIXct[1:25], format: NA NA ...
#> $ event_age : num [1:25] NA NA NA NA NA NA NA NA NA NA ...
#> $ event_type : chr [1:25] NA NA NA "TIA" ...
#> $ new_event_complete : chr [1:25] NA NA NA "Incomplete" ...
#> - attr(*, "problems")=<externalptr>
```
Column classes can be passed to
[`parse_data()`](https://agdamsbo.github.io/REDCapCAST/reference/parse_data.md).
Making a few crude assumption for factorising data,
[`numchar2fct()`](https://agdamsbo.github.io/REDCapCAST/reference/numchar2fct.md)
factorises numerical and character vectors based on a set threshold for
unique values:
``` r
mtcars |> str()
#> 'data.frame': 32 obs. of 11 variables:
#> $ mpg : num 21 21 22.8 21.4 18.7 18.1 14.3 24.4 22.8 19.2 ...
#> $ cyl : num 6 6 4 6 8 6 8 4 4 6 ...
#> $ disp: num 160 160 108 258 360 ...
#> $ hp : num 110 110 93 110 175 105 245 62 95 123 ...
#> $ drat: num 3.9 3.9 3.85 3.08 3.15 2.76 3.21 3.69 3.92 3.92 ...
#> $ wt : num 2.62 2.88 2.32 3.21 3.44 ...
#> $ qsec: num 16.5 17 18.6 19.4 17 ...
#> $ vs : num 0 0 1 1 0 1 0 1 1 1 ...
#> $ am : num 1 1 1 0 0 0 0 0 0 0 ...
#> $ gear: num 4 4 4 3 3 3 3 4 4 4 ...
#> $ carb: num 4 4 1 1 2 1 4 2 2 4 ...
mtcars |>
numchar2fct(numeric.threshold = 6) |>
str()
#> 'data.frame': 32 obs. of 11 variables:
#> $ mpg : num 21 21 22.8 21.4 18.7 18.1 14.3 24.4 22.8 19.2 ...
#> $ cyl : Factor w/ 3 levels "4","6","8": 2 2 1 2 3 2 3 1 1 2 ...
#> $ disp: num 160 160 108 258 360 ...
#> $ hp : num 110 110 93 110 175 105 245 62 95 123 ...
#> $ drat: num 3.9 3.9 3.85 3.08 3.15 2.76 3.21 3.69 3.92 3.92 ...
#> $ wt : num 2.62 2.88 2.32 3.21 3.44 ...
#> $ qsec: num 16.5 17 18.6 19.4 17 ...
#> $ vs : Factor w/ 2 levels "0","1": 1 1 2 2 1 2 1 2 2 2 ...
#> $ am : Factor w/ 2 levels "0","1": 2 2 2 1 1 1 1 1 1 1 ...
#> $ gear: Factor w/ 3 levels "3","4","5": 2 2 2 1 1 1 1 2 2 2 ...
#> $ carb: Factor w/ 6 levels "1","2","3","4",..: 4 4 1 1 2 1 4 2 2 4 ...
```
``` r
ds_parsed|>
numchar2fct(numeric.threshold = 2) |>
str()
#> tibble [25 × 27] (S3: tbl_df/tbl/data.frame)
#> $ record_id : num [1:25] 1 2 2 2 3 3 3 3 3 3 ...
#> $ redcap_event_name : Factor w/ 3 levels "inclusion","follow1",..: 1 1 2 2 1 2 3 2 2 3 ...
#> $ redcap_repeat_instrument : Factor w/ 1 level "New Event (?)": NA NA NA 1 NA NA NA 1 1 1 ...
#> $ redcap_repeat_instance : num [1:25] NA NA NA 1 NA NA NA 1 2 1 ...
#> $ cpr : chr [1:25] "1203401OB4" "0102342303" NA NA ...
#> $ inclusion : Date[1:25], format: "2023-03-13" "2023-03-01" ...
#> $ inclusion_time : 'hms' num [1:25] 12:38:49 10:38:57 NA NA ...
#> ..- attr(*, "units")= chr "secs"
#> $ dob : Date[1:25], format: "1940-03-12" "1934-02-01" ...
#> $ age : num [1:25] 83 89.1 NA NA 66.1 ...
#> $ age_integer : num [1:25] 83 89 NA NA 66 NA NA NA NA NA ...
#> $ sex : Factor w/ 2 levels "female","male": 1 2 NA NA 2 NA NA NA NA NA ...
#> $ cohabitation : Factor w/ 2 levels "Yes","No": 1 1 NA NA 2 NA NA NA NA NA ...
#> $ hypertension : Factor w/ 2 levels "No","Yes": 1 1 NA NA 2 NA NA NA NA NA ...
#> $ diabetes : Factor w/ 2 levels "Yes","No": 1 2 NA NA 1 NA NA NA NA NA ...
#> $ region : Factor w/ 3 levels "East","South",..: 1 2 NA NA 3 NA NA NA NA NA ...
#> $ baseline_data_start_complete: Factor w/ 2 levels "Incomplete","Complete": 1 1 NA NA 1 NA NA NA NA NA ...
#> $ mrs_assessed : Factor w/ 1 level "Yes": 1 1 1 NA NA 1 1 NA NA NA ...
#> $ mrs_date : Date[1:25], format: "2023-03-13" "2023-03-07" ...
#> $ mrs_score : num [1:25] 1 1 3 NA NA 2 1 NA NA NA ...
#> $ mrs_complete : Factor w/ 1 level "Incomplete": 1 1 1 NA 1 1 1 NA NA NA ...
#> $ con_mrs : logi [1:25] NA NA NA NA NA NA ...
#> $ con_calc : logi [1:25] NA NA NA NA NA NA ...
#> $ consensus_complete : Factor w/ 1 level "Incomplete": NA NA 1 NA NA 1 1 NA NA NA ...
#> $ event_datetime : POSIXct[1:25], format: NA NA ...
#> $ event_age : num [1:25] NA NA NA NA NA NA NA NA NA NA ...
#> $ event_type : Factor w/ 4 levels "TIA","AIS","ICH",..: NA NA NA 1 NA NA NA 2 3 3 ...
#> $ new_event_complete : Factor w/ 2 levels "Incomplete","Complete": NA NA NA 1 NA NA NA 1 1 1 ...
#> - attr(*, "problems")=<externalptr>
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Articles • 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="Articles"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Articles • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Articles"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -56,7 +56,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

7
articles/index.md Normal file
View file

@ -0,0 +1,7 @@
# Articles
### All vignettes
- [Database-creation](https://agdamsbo.github.io/REDCapCAST/articles/Database-creation.md):
- [REDCapCAST](https://agdamsbo.github.io/REDCapCAST/articles/REDCapCAST.md):
- [Shiny-app](https://agdamsbo.github.io/REDCapCAST/articles/Shiny-app.md):

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Authors and Citation • 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="Authors and Citation"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Authors and Citation • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png"><link rel="icon" sizes="any" href="favicon.ico"><link rel="manifest" href="site.webmanifest"><script src="deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="deps/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="Authors and Citation"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -52,17 +52,17 @@
<div class="section level2"> <div class="section level2">
<h2 id="citation">Citation</h2> <h2 id="citation">Citation</h2>
<p><small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/DESCRIPTION" class="external-link"><code>DESCRIPTION</code></a></small></p> <p><small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/DESCRIPTION" class="external-link"><code>DESCRIPTION</code></a></small></p>
<p>Damsbo A, Egeler P (2025). <p>Damsbo A, Egeler P (2025).
<em>REDCapCAST: REDCap Metadata Casting and Castellated Data Handling</em>. <em>REDCapCAST: REDCap Metadata Casting and Castellated Data Handling</em>.
R package version 25.3.2, https://agdamsbo.github.io/REDCapCAST/, <a href="https://github.com/agdamsbo/REDCapCAST" class="external-link">https://github.com/agdamsbo/REDCapCAST</a>. R package version 25.11.1, <a href="https://github.com/agdamsbo/REDCapCAST" class="external-link">https://github.com/agdamsbo/REDCapCAST</a>.
</p> </p>
<pre>@Manual{, <pre>@Manual{,
title = {REDCapCAST: REDCap Metadata Casting and Castellated Data Handling}, title = {REDCapCAST: REDCap Metadata Casting and Castellated Data Handling},
author = {Andreas Gammelgaard Damsbo and Paul Egeler}, author = {Andreas Gammelgaard Damsbo and Paul Egeler},
year = {2025}, year = {2025},
note = {R package version 25.3.2, https://agdamsbo.github.io/REDCapCAST/}, note = {R package version 25.11.1},
url = {https://github.com/agdamsbo/REDCapCAST}, url = {https://github.com/agdamsbo/REDCapCAST},
}</pre> }</pre>
</div> </div>
@ -76,7 +76,7 @@ R package version 25.3.2, https://agdamsbo.github.io/REDCapCAST/, <a href="https
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

25
authors.md Normal file
View file

@ -0,0 +1,25 @@
# Authors and Citation
## Authors
- **Andreas Gammelgaard Damsbo**. Author, maintainer.
[](https://orcid.org/0000-0002-7559-1154)
- **Paul Egeler**. Author. [](https://orcid.org/0000-0001-6948-9498)
## Citation
Source:
[`DESCRIPTION`](https://github.com/agdamsbo/REDCapCAST/blob/main/DESCRIPTION)
Damsbo A, Egeler P (2025). *REDCapCAST: REDCap Metadata Casting and
Castellated Data Handling*. R package version 25.11.1,
<https://github.com/agdamsbo/REDCapCAST>.
@Manual{,
title = {REDCapCAST: REDCap Metadata Casting and Castellated Data Handling},
author = {Andreas Gammelgaard Damsbo and Paul Egeler},
year = {2025},
note = {R package version 25.11.1},
url = {https://github.com/agdamsbo/REDCapCAST},
}

File diff suppressed because one or more lines are too long

View file

@ -1,17 +1,16 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>REDCap Metadata Casting and Castellated Data Handling • REDCapCAST</title> <title>REDCap Metadata Casting and Castellated Data Handling • REDCapCAST</title>
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png"> <!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="favicon-96x96.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png"> <link rel="icon" type="”image/svg+xml”" href="favicon.svg">
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="apple-touch-icon.png"> <link rel="apple-touch-icon" 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="icon" sizes="any" href="favicon.ico">
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="apple-touch-icon-76x76.png"> <link rel="manifest" href="site.webmanifest">
<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"> <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"> <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"> <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">
@ -28,7 +27,7 @@
<a class="navbar-brand me-2" href="index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -136,8 +135,8 @@
<div class="developers"> <div class="developers">
<h2 data-toc-skip>Developers</h2> <h2 data-toc-skip>Developers</h2>
<ul class="list-unstyled"> <ul class="list-unstyled">
<li>Andreas Gammelgaard Damsbo <br><small class="roles"> Author, maintainer </small> <a href="https://orcid.org/0000-0002-7559-1154" target="orcid.widget" aria-label="ORCID" class="external-link"><span class="fab fa-orcid orcid" aria-hidden="true"></span></a> </li> <li>Andreas Gammelgaard Damsbo <br><small class="roles"> Author, maintainer </small> <a href="https://orcid.org/0000-0002-7559-1154" target="orcid.widget" aria-label="ORCID" class="external-link"><span class="fab fa-orcid orcid" aria-hidden="true"></span></a> </li>
<li>Paul Egeler <br><small class="roles"> Author </small> <a href="https://orcid.org/0000-0001-6948-9498" target="orcid.widget" aria-label="ORCID" class="external-link"><span class="fab fa-orcid orcid" aria-hidden="true"></span></a> </li> <li>Paul Egeler <br><small class="roles"> Author </small> <a href="https://orcid.org/0000-0001-6948-9498" target="orcid.widget" aria-label="ORCID" class="external-link"><span class="fab fa-orcid orcid" aria-hidden="true"></span></a> </li>
</ul> </ul>
</div> </div>
@ -165,7 +164,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer> </footer>

82
index.md Normal file
View file

@ -0,0 +1,82 @@
# REDCapCAST package ![](reference/figures/logo.png)
Casting metadata for REDCap database creation and handling of
castellated data using repeated instruments and longitudinal projects in
REDCap.
This is implemented with
- An app-interface for easy database creation [accessible
here](https://agdamsbo.shinyapps.io/redcapcast/) or available to run
locally with
[`shiny_cast()`](https://agdamsbo.github.io/REDCapCAST/reference/shiny_cast.md)
allowing you to easily create a REDCap database based on an existing
spreadsheet.
- Export data from REDCap in different formats handling castellated
data, and on default only export requested data, this is mainly
through
[`read_redcap_tables()`](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_tables.md).
REDCapCAST was initially build on, and still includes code from
[pegeler/REDCapRITS](https://github.com/pegeler/REDCapRITS), and relies
on functions from the
[`REDCapR`](https://ouhscbbmc.github.io/REDCapR/)-project
## History
This package was originally forked from
[pegeler/REDCapRITS](https://github.com/pegeler/REDCapRITS). The
`REDCapRITS` represents great and extensive work to handle castellated
REDCap data in different programming languages. REDCapCAST has evolved
into much more than just handling castellated data and so has been
detatched from the original project while still relying on the main
`REDCap_split` function. All access to the REDCap database is build on
the outstanding work in [`REDCapR`](#id_0).
This package really started out of frustration during my PhD in health
science hearing colleagues complaining about that “castellated” data
formatting of REDCap exports when doing longitudinal projects and being
used to wide data. This led to some bad decisions in building databases
avoiding repeated instruments. This package solves these challenges, but
solutions are also implemented else where like the
[redcapAPI](https://github.com/vubiostat/redcapAPI) or
[REDCapTidieR](https://github.com/CHOP-CGTInformatics/REDCapTidieR)
packages, which are bigger project.
To help new PhD students and other researchers, I have also worked on
creating a few helper/wrapper-functions to ease data access.
Documentation is on its way.
For any more advanced uses, consider using the
[`redcapAPI`](https://github.com/vubiostat/redcapAPI) or
[`REDCapR`](https://ouhscbbmc.github.io/REDCapR/) packages.
## Future
The plan with this package is to be bundled with a Handbook on working
with REDCap from R. This work is in progress but is limited by the time
available. Please feel free to contact me or create and issue with ideas
for future additions.
## Installation and use
The package is available on CRAN. Install the latest version:
install.packages("REDCapCAST")
Install the latest version directly from GitHub:
require("remotes")
remotes::install_github("agdamsbo/REDCapCAST")
Launch the REDCapCAST app interface directly on your own machine:
REDCapCAST::shiny_cast()
## Code of Conduct
Please note that the REDCapCAST project is released with a [Contributor
Code of
Conduct](https://agdamsbo.github.io/REDCapCAST/CODE_OF_CONDUCT.html). By
contributing to this project, you agree to abide by its terms.

View file

@ -11,4 +11,6 @@ document.addEventListener("DOMContentLoaded", function () {
macros: macros, macros: macros,
fleqn: false fleqn: false
}); });
}}}); }
}
});

View file

@ -26,7 +26,7 @@ const setTheme = theme => {
} }
} }
function bsSetupThemeToggle () { function bsSetupThemeToggle() {
'use strict' 'use strict'
const showActiveTheme = (theme, focus = false) => { const showActiveTheme = (theme, focus = false) => {
@ -35,7 +35,7 @@ function bsSetupThemeToggle () {
document.querySelectorAll('[data-bs-theme-value]').forEach(element => { document.querySelectorAll('[data-bs-theme-value]').forEach(element => {
const buttonTheme = element.getAttribute('data-bs-theme-value') const buttonTheme = element.getAttribute('data-bs-theme-value')
const isActive = buttonTheme == theme const isActive = buttonTheme == theme
element.classList.toggle('active', isActive) element.classList.toggle('active', isActive)
element.setAttribute('aria-pressed', isActive) element.setAttribute('aria-pressed', isActive)

245
llms.txt Normal file
View file

@ -0,0 +1,245 @@
# REDCapCAST package ![](reference/figures/logo.png)
Casting metadata for REDCap database creation and handling of
castellated data using repeated instruments and longitudinal projects in
REDCap.
This is implemented with
- An app-interface for easy database creation [accessible
here](https://agdamsbo.shinyapps.io/redcapcast/) or available to run
locally with
[`shiny_cast()`](https://agdamsbo.github.io/REDCapCAST/reference/shiny_cast.md)
allowing you to easily create a REDCap database based on an existing
spreadsheet.
- Export data from REDCap in different formats handling castellated
data, and on default only export requested data, this is mainly
through
[`read_redcap_tables()`](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_tables.md).
REDCapCAST was initially build on, and still includes code from
[pegeler/REDCapRITS](https://github.com/pegeler/REDCapRITS), and relies
on functions from the
[`REDCapR`](https://ouhscbbmc.github.io/REDCapR/)-project
## History
This package was originally forked from
[pegeler/REDCapRITS](https://github.com/pegeler/REDCapRITS). The
`REDCapRITS` represents great and extensive work to handle castellated
REDCap data in different programming languages. REDCapCAST has evolved
into much more than just handling castellated data and so has been
detatched from the original project while still relying on the main
`REDCap_split` function. All access to the REDCap database is build on
the outstanding work in [`REDCapR`](#id_0).
This package really started out of frustration during my PhD in health
science hearing colleagues complaining about that “castellated” data
formatting of REDCap exports when doing longitudinal projects and being
used to wide data. This led to some bad decisions in building databases
avoiding repeated instruments. This package solves these challenges, but
solutions are also implemented else where like the
[redcapAPI](https://github.com/vubiostat/redcapAPI) or
[REDCapTidieR](https://github.com/CHOP-CGTInformatics/REDCapTidieR)
packages, which are bigger project.
To help new PhD students and other researchers, I have also worked on
creating a few helper/wrapper-functions to ease data access.
Documentation is on its way.
For any more advanced uses, consider using the
[`redcapAPI`](https://github.com/vubiostat/redcapAPI) or
[`REDCapR`](https://ouhscbbmc.github.io/REDCapR/) packages.
## Future
The plan with this package is to be bundled with a Handbook on working
with REDCap from R. This work is in progress but is limited by the time
available. Please feel free to contact me or create and issue with ideas
for future additions.
## Installation and use
The package is available on CRAN. Install the latest version:
install.packages("REDCapCAST")
Install the latest version directly from GitHub:
require("remotes")
remotes::install_github("agdamsbo/REDCapCAST")
Launch the REDCapCAST app interface directly on your own machine:
REDCapCAST::shiny_cast()
## Code of Conduct
Please note that the REDCapCAST project is released with a [Contributor
Code of
Conduct](https://agdamsbo.github.io/REDCapCAST/CODE_OF_CONDUCT.html). By
contributing to this project, you agree to abide by its terms.
# Package index
## All functions
- [`REDCap_split()`](https://agdamsbo.github.io/REDCapCAST/reference/REDCap_split.md)
: Split REDCap repeating instruments table into multiple tables
- [`all_na()`](https://agdamsbo.github.io/REDCapCAST/reference/all_na.md)
: Check if vector is all NA
- [`apply_factor_labels()`](https://agdamsbo.github.io/REDCapCAST/reference/apply_factor_labels.md)
: Preserve all factor levels from REDCap data dictionary in data
export
- [`apply_field_label()`](https://agdamsbo.github.io/REDCapCAST/reference/apply_field_label.md)
: Apply REDCap filed labels to data frame
- [`as_factor()`](https://agdamsbo.github.io/REDCapCAST/reference/as_factor.md)
: Convert labelled vectors to factors while preserving attributes
- [`as_logical()`](https://agdamsbo.github.io/REDCapCAST/reference/as_logical.md)
: Interpret specific binary values as logicals
- [`case_match_regex_list()`](https://agdamsbo.github.io/REDCapCAST/reference/case_match_regex_list.md)
: List-base regex case_when
- [`cast_data_overview()`](https://agdamsbo.github.io/REDCapCAST/reference/cast_data_overview.md)
: Overview of REDCapCAST data for shiny
- [`cast_meta_overview()`](https://agdamsbo.github.io/REDCapCAST/reference/cast_meta_overview.md)
: Overview of REDCapCAST meta data for shiny
- [`char2choice()`](https://agdamsbo.github.io/REDCapCAST/reference/char2choice.md)
: Simple function to generate REDCap choices from character vector
- [`char2cond()`](https://agdamsbo.github.io/REDCapCAST/reference/char2cond.md)
: Simple function to generate REDCap branching logic from character
vector
- [`clean_field_label()`](https://agdamsbo.github.io/REDCapCAST/reference/clean_field_label.md)
: Very simple function to remove rich text formatting from field label
and save the first paragraph ('\<p\>...\</p\>').
- [`clean_redcap_name()`](https://agdamsbo.github.io/REDCapCAST/reference/clean_redcap_name.md)
: clean_redcap_name
- [`compact_vec()`](https://agdamsbo.github.io/REDCapCAST/reference/compact_vec.md)
: Compacting a vector of any length with or without names
- [`create_html_table()`](https://agdamsbo.github.io/REDCapCAST/reference/create_html_table.md)
: Create two-column HTML table for data piping in REDCap instruments
- [`create_instrument_meta()`](https://agdamsbo.github.io/REDCapCAST/reference/create_instrument_meta.md)
: DEPRICATED Create zips file with necessary content based on data set
- [`cut_string_length()`](https://agdamsbo.github.io/REDCapCAST/reference/cut_string_length.md)
: Cut string to desired length
- [`d2w()`](https://agdamsbo.github.io/REDCapCAST/reference/d2w.md) :
Convert single digits to words
- [`doc2dd()`](https://agdamsbo.github.io/REDCapCAST/reference/doc2dd.md)
: Doc table to data dictionary - EARLY, DOCS MISSING
- [`ds2dd()`](https://agdamsbo.github.io/REDCapCAST/reference/ds2dd.md)
: (DEPRECATED) Data set to data dictionary function
- [`ds2dd_detailed()`](https://agdamsbo.github.io/REDCapCAST/reference/ds2dd_detailed.md)
: Extract data from stata file for data dictionary
- [`easy_redcap()`](https://agdamsbo.github.io/REDCapCAST/reference/easy_redcap.md)
: Secure API key storage and data acquisition in one
- [`export_redcap_instrument()`](https://agdamsbo.github.io/REDCapCAST/reference/export_redcap_instrument.md)
: Creates zip-file with necessary content to manually add instrument
to database
- [`fct2num()`](https://agdamsbo.github.io/REDCapCAST/reference/fct2num.md)
: Allows conversion of factor to numeric values preserving original
levels
- [`fct_drop()`](https://agdamsbo.github.io/REDCapCAST/reference/fct_drop.md)
: Drop unused levels preserving label data
- [`file_extension()`](https://agdamsbo.github.io/REDCapCAST/reference/file_extension.md)
: DEPRECATED Helper to import files correctly
- [`focused_metadata()`](https://agdamsbo.github.io/REDCapCAST/reference/focused_metadata.md)
: focused_metadata
- [`format_redcap_factor()`](https://agdamsbo.github.io/REDCapCAST/reference/format_redcap_factor.md)
: Converts REDCap choices to factor levels and stores in labels
attribute
- [`format_subheader()`](https://agdamsbo.github.io/REDCapCAST/reference/format_subheader.md)
: Sub-header formatting wrapper
- [`get_api_key()`](https://agdamsbo.github.io/REDCapCAST/reference/get_api_key.md)
: Retrieve project API key if stored, if not, set and retrieve
- [`get_attr()`](https://agdamsbo.github.io/REDCapCAST/reference/get_attr.md)
: Extract attribute. Returns NA if none
- [`get_id_name()`](https://agdamsbo.github.io/REDCapCAST/reference/get_id_name.md)
: Get the id name
- [`guess_time_only()`](https://agdamsbo.github.io/REDCapCAST/reference/guess_time_only.md)
: Guess time variables based on naming pattern
- [`guess_time_only_filter()`](https://agdamsbo.github.io/REDCapCAST/reference/guess_time_only_filter.md)
: Try at determining which are true time only variables
- [`haven_all_levels()`](https://agdamsbo.github.io/REDCapCAST/reference/haven_all_levels.md)
: Finish incomplete haven attributes substituting missings with values
- [`hms2character()`](https://agdamsbo.github.io/REDCapCAST/reference/hms2character.md)
: Change "hms" to "character" for REDCap upload.
- [`html_tag_wrap()`](https://agdamsbo.github.io/REDCapCAST/reference/html_tag_wrap.md)
: Simple html tag wrapping for REDCap text formatting
- [`is.labelled()`](https://agdamsbo.github.io/REDCapCAST/reference/is.labelled.md)
: Tests for multiple label classes
- [`is_missing()`](https://agdamsbo.github.io/REDCapCAST/reference/is_missing.md)
: Multi missing check
- [`is_repeated_longitudinal()`](https://agdamsbo.github.io/REDCapCAST/reference/is_repeated_longitudinal.md)
: Test if repeatable or longitudinal
- [`mark_complete()`](https://agdamsbo.github.io/REDCapCAST/reference/mark_complete.md)
: Completion marking based on completed upload
- [`match_fields_to_form()`](https://agdamsbo.github.io/REDCapCAST/reference/match_fields_to_form.md)
: Match fields to forms
- [`mtcars_redcap`](https://agdamsbo.github.io/REDCapCAST/reference/mtcars_redcap.md)
: mtcars dataset slightly modified to use for Shiny app upload
demonstration
- [`named_levels()`](https://agdamsbo.github.io/REDCapCAST/reference/named_levels.md)
: Get named vector of factor levels and values
- [`nav_bar_page()`](https://agdamsbo.github.io/REDCapCAST/reference/nav_bar_page.md)
: Nav_bar defining function for shiny ui
- [`numchar2fct()`](https://agdamsbo.github.io/REDCapCAST/reference/numchar2fct.md)
: Applying var2fct across data set
- [`parse_data()`](https://agdamsbo.github.io/REDCapCAST/reference/parse_data.md)
: Helper to auto-parse un-formatted data with haven and readr
- [`possibly_numeric()`](https://agdamsbo.github.io/REDCapCAST/reference/possibly_numeric.md)
: Tests if vector can be interpreted as numeric without introducing
NAs by coercion
- [`possibly_roman()`](https://agdamsbo.github.io/REDCapCAST/reference/possibly_roman.md)
: Test if vector can be interpreted as roman numerals
- [`process_user_input()`](https://agdamsbo.github.io/REDCapCAST/reference/process_user_input.md)
: User input processing
- [`process_user_input(`*`<character>`*`)`](https://agdamsbo.github.io/REDCapCAST/reference/process_user_input.character.md)
: User input processing character
- [`process_user_input(`*`<data.frame>`*`)`](https://agdamsbo.github.io/REDCapCAST/reference/process_user_input.data.frame.md)
: User input processing data.frame
- [`process_user_input(`*`<default>`*`)`](https://agdamsbo.github.io/REDCapCAST/reference/process_user_input.default.md)
: User input processing default
- [`process_user_input(`*`<response>`*`)`](https://agdamsbo.github.io/REDCapCAST/reference/process_user_input.response.md)
: User input processing response
- [`read_input()`](https://agdamsbo.github.io/REDCapCAST/reference/read_input.md)
: Flexible file import based on extension
- [`read_redcap_instrument()`](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_instrument.md)
: Convenience function to download complete instrument, using token
storage in keyring.
- [`read_redcap_tables()`](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_tables.md)
: Download REDCap data
- [`redcap_wider()`](https://agdamsbo.github.io/REDCapCAST/reference/redcap_wider.md)
: Transforms list of REDCap data.frames to a single wide data.frame
- [`redcapcast_data`](https://agdamsbo.github.io/REDCapCAST/reference/redcapcast_data.md)
: Data set for demonstration
- [`redcapcast_meta`](https://agdamsbo.github.io/REDCapCAST/reference/redcapcast_meta.md)
: REDCap metadata from data base
- [`replace_curly_quote()`](https://agdamsbo.github.io/REDCapCAST/reference/replace_curly_quote.md)
: Replace curly apostrophes and quotes from word
- [`sanitize_split()`](https://agdamsbo.github.io/REDCapCAST/reference/sanitize_split.md)
: Sanitize list of data frames
- [`set_attr()`](https://agdamsbo.github.io/REDCapCAST/reference/set_attr.md)
: Set attributes for named attribute. Appends if attr is NULL
- [`shiny_cast()`](https://agdamsbo.github.io/REDCapCAST/reference/shiny_cast.md)
: Launch the included Shiny-app for database casting and upload
- [`split_non_repeating_forms()`](https://agdamsbo.github.io/REDCapCAST/reference/split_non_repeating_forms.md)
: Split a data frame into separate tables for each form
- [`strsplitx()`](https://agdamsbo.github.io/REDCapCAST/reference/strsplitx.md)
: Extended string splitting
- [`suffix2label()`](https://agdamsbo.github.io/REDCapCAST/reference/suffix2label.md)
: Transfer variable name suffix to label in widened data
- [`time_only_correction()`](https://agdamsbo.github.io/REDCapCAST/reference/time_only_correction.md)
: Correction based on time_only_filter function
- [`var2fct()`](https://agdamsbo.github.io/REDCapCAST/reference/var2fct.md)
: Convert vector to factor based on threshold of number of unique
levels
- [`vec2choice()`](https://agdamsbo.github.io/REDCapCAST/reference/vec2choice.md)
: Named vector to REDCap choices (\`wrapping compact_vec()\`)
# Articles
### All vignettes
- [Database-creation](https://agdamsbo.github.io/REDCapCAST/articles/Database-creation.md):
- [REDCapCAST](https://agdamsbo.github.io/REDCapCAST/articles/REDCapCAST.md):
- [Shiny-app](https://agdamsbo.github.io/REDCapCAST/articles/Shiny-app.md):

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Changelog • 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="Changelog"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Changelog • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Changelog"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,9 +35,14 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Changelog</h1> <h1>Changelog</h1>
<small>Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/NEWS.md" class="external-link"><code>NEWS.md</code></a></small> <small>Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/NEWS.md" class="external-link"><code>NEWS.md</code></a></small>
</div> </div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="25.11.1" id="redcapcast-25111">REDCapCAST 25.11.1<a class="anchor" aria-label="anchor" href="#redcapcast-25111"></a></h2>
<ul><li><p>FIX: logiccals exported as numeric for data upload</p></li>
<li><p>FIX: improved name cleaning</p></li>
</ul></div>
<div class="section level2"> <div class="section level2">
<h2 class="pkg-version" data-toc-text="25.3.2" id="redcapcast-2532">REDCapCAST 25.3.2<a class="anchor" aria-label="anchor" href="#redcapcast-2532"></a></h2><p class="text-muted">CRAN release: 2025-03-10</p> <h2 class="pkg-version" data-toc-text="25.3.2" id="redcapcast-2532">REDCapCAST 25.3.2<a class="anchor" aria-label="anchor" href="#redcapcast-2532"></a></h2><p class="text-muted">CRAN release: 2025-03-10</p>
<ul><li>BUG: The <code><a href="../reference/redcap_wider.html">redcap_wider()</a></code> function would attempt to pivot empty selection of columns from list, and failing, causing all functions relying on this to fail. Fixed by filtering out data.frames in list with no additional columns than the “generics”.</li> <ul><li>BUG: The <code><a href="../reference/redcap_wider.html">redcap_wider()</a></code> function would attempt to pivot empty selection of columns from list, and failing, causing all functions relying on this to fail. Fixed by filtering out data.frames in list with no additional columns than the “generics”.</li>
@ -212,7 +217,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

460
news/index.md Normal file
View file

@ -0,0 +1,460 @@
# Changelog
## REDCapCAST 25.11.1
- FIX: logiccals exported as numeric for data upload
- FIX: improved name cleaning
## REDCapCAST 25.3.2
CRAN release: 2025-03-10
- BUG: The
[`redcap_wider()`](https://agdamsbo.github.io/REDCapCAST/reference/redcap_wider.md)
function would attempt to pivot empty selection of columns from list,
and failing, causing all functions relying on this to fail. Fixed by
filtering out data.frames in list with no additional columns than the
“generics”.
## REDCapCAST 25.3.1
CRAN release: 2025-03-05
- FIX:
[`as_factor()`](https://agdamsbo.github.io/REDCapCAST/reference/as_factor.md)
now interprets empty variables with empty levels attribute as logicals
to avoid returning factors with empty levels.
- NEW:
[`as_logical()`](https://agdamsbo.github.io/REDCapCAST/reference/as_logical.md):
interprets vectors with two levels as logical if values matches
supplied list of logical pairs like “TRUE”/“FALSE”, “Yes”/“No” or 1/2.
Eases interpretation of data from databases with minimal metadata.
Works on vectors and for data.frames. Interprets vectors with single
value also matching to any of supplied levels (Chooses first match
pair if several matches).
- NEW:
[`easy_redcap()`](https://agdamsbo.github.io/REDCapCAST/reference/easy_redcap.md):
new parameter `data_format` to specify data format as c(“wide”,
“list”, “redcap”, “long”). For now “redcap” and “long” is treated
equally. This was added to ease MMRM analyses. In that case, missing
baseline values can be carried forward as “last observation carried
forward” using the
[`tidyr::fill()`](https://tidyr.tidyverse.org/reference/fill.html)
function specifying variables to fill. Interesting discussion on
filling data [here on
Stackoverflow](https://stackoverflow.com/a/13810615).
`redcap_read_tables()` now has the option “none” for the `split_forms`
parameter to allow not splitting the data.
- FIX:
[`ds2dd_detailed()`](https://agdamsbo.github.io/REDCapCAST/reference/ds2dd_detailed.md):
The `convert_logicals` parameter has been turned off by default and
logicals are now interpreted as field type “truefalse”. Converting
logicals to factors would result in the numeric values being 1 for
FALSE and 2 for TRUE, which is opposite of the traditional notation
and could lead to serous problems if not handled correctly. This
should solve it.
## REDCapCAST 25.1.1
CRAN release: 2025-01-29
The newly introduced extension of
[`forcats::fct_drop()`](https://forcats.tidyverse.org/reference/fct_drop.html)
has been corrected to work as intended as a method.
Conversion of column names to `field_names` are aligning better with
REDCap naming.
Shorten variable names above 100 characters (REDCap criteria; note
recommended variable name length is \<26)
Fixed a params conflict in easy_redcap() when specifying raw_or_label.
## REDCapCAST 24.12.1
CRAN release: 2024-12-02
This release attempts to solve problems hosting the shiny_cast app,
while also implementing functions to preserve as much meta data as
possible from the REDCap database when exporting data.
The hosting on shinyapps.io has given a lot of trouble recently.
Modified package structure a little around the
[`shiny_cast()`](https://agdamsbo.github.io/REDCapCAST/reference/shiny_cast.md),
to accommodate an alternative hosting approach with all package
functions included in a script instead of requiring the package.
- NEW: A new option to `raw_or_label` in
[`read_redcap_tables()`](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_tables.md)
has been added: “both”. Get raw values with REDCap labels applied as
labels. Use
[`as_factor()`](https://agdamsbo.github.io/REDCapCAST/reference/as_factor.md)
to format factors with original labels and use the `gtsummary` package
to easily get beautiful tables with original labels from REDCap. Use
[`fct_drop()`](https://agdamsbo.github.io/REDCapCAST/reference/fct_drop.md)
to drop empty levels.
- NEW: fct_drop() has been added with an extension to
[`forcats::fct_drop()`](https://forcats.tidyverse.org/reference/fct_drop.html),
that works across data.frames. Use as
[`fct_drop()`](https://agdamsbo.github.io/REDCapCAST/reference/fct_drop.md).
- CHANGE: the default data export method of
[`easy_redcap()`](https://agdamsbo.github.io/REDCapCAST/reference/easy_redcap.md)
has been changed to use the new labelled data export with
[`read_redcap_tables()`](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_tables.md).
## REDCapCAST 24.11.3
- BUG: shiny_cast() fails to load as I missed loading REDCapCAST library
in ui.r. Fixed. Tests would be great.
## REDCapCAST 24.11.2
CRAN release: 2024-11-22
24.11.1 was rejected on CRAN based on wrong title capitalisation. This
was an opportunity to extend the package overhaul. And this actually
turned out to be a major step towards a very usable shiny app which have
received most of the focus.
I have implemented option to specify categorical variables to factorize,
but doing this with a modified version of {forcats} and {haven}s
[`as_factor()`](https://agdamsbo.github.io/REDCapCAST/reference/as_factor.md),
that will preserve any attributes applied to the data to be able to
upload and cast REDCap meta data from richly formatted data (use .rds).
No matter the input type, all input is parsed using the default options
from the {readr} package. Also to avoid mis-labelling, logicals are
converted to factors as REDCap truefalse class follows different naming
conversion compared to R. Also correct support for variable labels as
field labels (use .rds formatted data and label with
labelled::var_label())
Vignettes and documentation have been restructured.
This package has been detached from the REDCapRITS, which it was
originally forked from. The data split function will be kept, while
testing will be rewritten. This projects has evolved away from the
original fork.
## REDCapCAST 24.11.1
Revised tests.
Documentation has been slightly updated to highlight the shiny app for
casting REDCap metadata. I am working on hosting my own Shiny Server.
#### Functions:
- Bug: form.name specified to ds2dd_detailed() was ignored.
Corrected to only be ignored if form.sep is specified. Added
handling of re-occurring `form.sep` pattern.
- New:
[`export_redcap_instrument()`](https://agdamsbo.github.io/REDCapCAST/reference/export_redcap_instrument.md)
is a new version of
[`create_instrument_meta()`](https://agdamsbo.github.io/REDCapCAST/reference/create_instrument_meta.md),
that will only export a single instrument. Multiple instrument export
can be done with [`lapply()`](https://rdrr.io/r/base/lapply.html) or
[`purrr::map()`](https://purrr.tidyverse.org/reference/map.html). This
allows for inclusion of this functionality in the Shiny implementation
and is easier to handle.
[`create_instrument_meta()`](https://agdamsbo.github.io/REDCapCAST/reference/create_instrument_meta.md)
is deprecated.
- Improved:
[`shiny_cast()`](https://agdamsbo.github.io/REDCapCAST/reference/shiny_cast.md)
app has been updated to actually work if you install the package and
not clones the whole repository.
#### Shiny:
- New: Major overhaul of the app interface with the introduction of
`bslib` for building the page. Also Detailed documentation added for
the app workflow.
- New: Export a REDCap instrument ready to add to your database based on
an uploaded spreadsheet. This is thanks to the
[`export_redcap_instrument()`](https://agdamsbo.github.io/REDCapCAST/reference/export_redcap_instrument.md)
function. This functionality is intended for projects in production
and adding instruments should be handled manually and not by API
upload.
- Bug: Export datadictionary with “” instead of “NA” for NAs. Upload to
REDCap failed. Not anymore.
The shiny implementation is included with this package. Implementing in
shinylive may be looked into again later.
## REDCapCAST 24.10.3
CRAN release: 2024-10-03
Updated links and spelling.
## REDCapCAST 24.10.1
Minor changes to pass tests and renv is out. `rhub` is really not
running as smooth as previously.
## REDCapCAST 24.6.1
CRAN release: 2024-06-07
#### Functions
- Fix:
[`read_redcap_tables()`](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_tables.md):
field names testing allows to include “\[form_name\]\_complete”
fields.
- Fix:
[`ds2dd_detailed()`](https://agdamsbo.github.io/REDCapCAST/reference/ds2dd_detailed.md):
default record ID name is now “record_id”, the REDCap default. Default
is still to use the first column name. Support was added to interpret
column name prefix or suffix as instrument names. See the examples.
- New:
[`create_instrument_meta()`](https://agdamsbo.github.io/REDCapCAST/reference/create_instrument_meta.md):
creates zip with instrument files to allow adding new instruments to
project in production. Takes data dictionary as input and creates a
zip for each instrument specified by the `form_name` column.
- New:
[`doc2dd()`](https://agdamsbo.github.io/REDCapCAST/reference/doc2dd.md):
function to convert document table to data dictionary. This allows to
specify instrument or whole data dictionary in text document, which
for most is easier to work with and easily modifiable. The generic
case is a data frame with variable names as values in a column. This
is a format like the REDCap data dictionary, but gives a few options
for formatting. Has a few related functions for data handling and
formatting. One interesting function is
[`case_match_regex_list()`](https://agdamsbo.github.io/REDCapCAST/reference/case_match_regex_list.md),
which allows for a dynamic
[`dplyr::case_when()`](https://dplyr.tidyverse.org/reference/case_when.html)-like
approach for regex-matching. I think it is neat at least.
#### Documentation and more
- Dependencies: In order to deploy
[`shiny_cast()`](https://agdamsbo.github.io/REDCapCAST/reference/shiny_cast.md)
with `shinylive`, I need to remove `curl` as a dependency. To
accomplish this, the `shiny_deploy()` helper functions has been moved
to the package
[`project.aid`](https://github.com/agdamsbo/project.aid). This was
before realising that `REDCapR` has `curl` as dependency, which is the
culprit. `REDCapCAST` is not going to be a `shinylive` web-app without
removing `REDCapR` dependency or any other REDCap database
interaction, which would defy the purpose. Ill stick to hosted Shiny
app instead.
## REDCapCAST 24.2.1
CRAN release: 2024-02-28
#### Functions
- Fix:
[`ds2dd()`](https://agdamsbo.github.io/REDCapCAST/reference/ds2dd.md):
uses correct default dd column names. Will be deprecated.
- Fix:
[`easy_redcap()`](https://agdamsbo.github.io/REDCapCAST/reference/easy_redcap.md):
fixed to actually allow project naming. also specifically asks for
uri. widening updated to work.
- Fix:
[`redcap_wider()`](https://agdamsbo.github.io/REDCapCAST/reference/redcap_wider.md):
updated to accept more formats and allow handling of simple projects
without repeating instruments and not longitudinal.
- Fix:
[`read_redcap_tables()`](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_tables.md):
now handles non-longitudinal project without repeatable instruments.
- NEW:
[`ds2dd_detailed()`](https://agdamsbo.github.io/REDCapCAST/reference/ds2dd_detailed.md):
extension of the
[`ds2dd()`](https://agdamsbo.github.io/REDCapCAST/reference/ds2dd.md),
which serves to preserve as much metadata as possible automatically.
Depends on a group of helper functions also introduced. Of special
note is the
[`guess_time_only_filter()`](https://agdamsbo.github.io/REDCapCAST/reference/guess_time_only_filter.md),
which will try to guess which columns/variables should be formatted as
time only formats. Supports hms time format. DETAILED INSTRUCTION AND
VIGNETTE IS PENDING.
- NEW:
[`read_redcap_instrument()`](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_instrument.md):
convenience function to retrieve complete instrument. Goes a little
against the focused approach. With
[`REDCapR::redcap_read()`](https://ouhscbbmc.github.io/REDCapR/reference/redcap_read.html)
you can specify a form to download. You have to also specify the
record id variable though. This is done for you with
[`read_redcap_instrument()`](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_instrument.md).
Nothing fancy.
- NEW:
[`shiny_cast()`](https://agdamsbo.github.io/REDCapCAST/reference/shiny_cast.md):
[Shiny](https://shiny.posit.co/) application to ease the process of
converting a spreadsheet/data set to a REDCap database. The app runs
locally and data is transferred securely. You can just create and
upload the data dictionary, but you can also transfer the given data
in the same process. I plan to host the app with shinyapps.io, but for
now you can run it locally.
#### Other
I believe `renv` has now been added and runs correctly. After clone, do
[`renv::restore()`](https://rstudio.github.io/renv/reference/restore.html)
to install all necessary package to modify the package. This seems to
always be back and forth. `renv` may be on its way out again.
Added a Code of Conduct.
## REDCapCAST 24.1.1
CRAN release: 2024-01-09
#### Functions
- Fix:
[`read_redcap_tables()`](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_tables.md):
checking form names based on data dictionary to allow handling of
non-longitudinal projects. Prints invalid form names and invalid event
names. If invalid form names are supplied to
[`REDCapR::redcap_read()`](https://ouhscbbmc.github.io/REDCapR/reference/redcap_read.html)
(which is the backbone), all forms are exported, which is not what we
want with a focused approach. Invalid event names will give an output
with a rather peculiar formatting. Checking of field names validity is
also added.
## REDCapCAST 23.12.1
CRAN release: 2023-12-20
One new function to ease secure dataset retrieval and a few bug fixes.
#### Functions
- New:
[`easy_redcap()`](https://agdamsbo.github.io/REDCapCAST/reference/easy_redcap.md)
function to ease the retrieval of a dataset with
[`read_redcap_tables()`](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_tables.md)
with `keyring`-package based key storage, which handles secure API
set, storage and retrieval. Relies on a small helper function,
[`get_api_key()`](https://agdamsbo.github.io/REDCapCAST/reference/get_api_key.md),
which wraps relevant `keyring`-functions. Includes option to cast the
data in a wide format with flag `widen.data`.
- Fix:
[`REDCap_split()`](https://agdamsbo.github.io/REDCapCAST/reference/REDCap_split.md):
when using this function on its own, supplying a data set with check
boxes would fail if metadata is supplied as a tibble. Metadata is now
converted to data.frame. Fixed.
- Fix:
[`read_redcap_tables()`](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_tables.md):
fixed bug when supplying events.
## REDCapCAST 23.6.2
CRAN release: 2023-07-04
This version marks the introduction of a few helper functions to handle
database creation.
#### Functions
- New:
[`ds2dd()`](https://agdamsbo.github.io/REDCapCAST/reference/ds2dd.md)
function migrating from the `stRoke`-package. Assists in building a
data dictionary for REDCap from a dataset.
- New:
[`strsplitx()`](https://agdamsbo.github.io/REDCapCAST/reference/strsplitx.md)
function to ease the string splitting as an extension of
[`base::strsplit()`](https://rdrr.io/r/base/strsplit.html).
Inspiration from <https://stackoverflow.com/a/11014253/21019325> and
<https://www.r-bloggers.com/2018/04/strsplit-but-keeping-the-delimiter/>.
- New: `d2n()` function converts single digits to written numbers. Used
to sanitize variable and form names in REDCap database creation. For
more universal number to word I would suggest `english::word()` or
[`xfun::numbers_to_words()`](https://rdrr.io/pkg/xfun/man/numbers_to_words.html),
though I have not been testing these.
## REDCapCAST 23.6.1
CRAN release: 2023-06-06
#### Documentation:
- Updated description.
- Look! A hex icon!
- Heading for CRAN.
## REDCapCAST 23.4.1
#### Documentation:
- Aiming for CRAN
## REDCapCAST 23.3.2
#### Documentation:
- Page added. Vignettes to follow.
- GithubActions tests added and code coverage assessed. Badge galore..
## REDCapCAST 23.3.1
#### New name: REDCapCAST
To reflect new functions and the limitation to only working in R, I have
changed the naming of the fork, while still, of course, maintaining the
status as a fork.
The versioning has moved to a monthly naming convention.
The main goal this package is to keep the option to only export a
defined subset of the whole dataset from the REDCap server as is made
possible through the
[`REDCapR::redcap_read()`](https://ouhscbbmc.github.io/REDCapR/reference/redcap_read.html)
function, and combine it with the work put into the REDCapRITS package
and the handling of longitudinal projects and/or projects with repeated
instruments.
#### Functions:
- [`read_redcap_tables()`](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_tables.md)
**NEW**: this function is mainly an implementation of the combined use
of
[`REDCapR::redcap_read()`](https://ouhscbbmc.github.io/REDCapR/reference/redcap_read.html)
and
[`REDCap_split()`](https://agdamsbo.github.io/REDCapCAST/reference/REDCap_split.md)
to maintain the focused nature of
[`REDCapR::redcap_read()`](https://ouhscbbmc.github.io/REDCapR/reference/redcap_read.html),
to only download the specified data. Also implements tests of valid
form names and event names. The usual fall-back solution was to get
all data.
- [`redcap_wider()`](https://agdamsbo.github.io/REDCapCAST/reference/redcap_wider.md)
**NEW**: this function pivots the long data frames from
[`read_redcap_tables()`](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_tables.md)
using
[`tidyr::pivot_wider()`](https://tidyr.tidyverse.org/reference/pivot_wider.html).
- [`focused_metadata()`](https://agdamsbo.github.io/REDCapCAST/reference/focused_metadata.md)
**NEW**: a hidden helper function to enable a focused data acquisition
approach to handle only a subset of metadata corresponding to the
focused dataset.
#### Notes:
- metadata handling **IMPROVED**: improved handling of different column
names in matadata (DataDictionary) from REDCap dependent on whether it
is acquired thorugh the api og downloaded from the server.

View file

@ -1,6 +1,6 @@
/* http://gregfranko.com/blog/jquery-best-practices/ */ /* http://gregfranko.com/blog/jquery-best-practices/ */
(function($) { (function ($) {
$(function() { $(function () {
$('nav.navbar').headroom(); $('nav.navbar').headroom();
@ -27,45 +27,45 @@
$('[data-bs-toggle="tooltip"]').tooltip(); $('[data-bs-toggle="tooltip"]').tooltip();
/* Clipboard --------------------------*/ /* Clipboard --------------------------*/
function changeTooltipMessage(element, msg) { function changeTooltipMessage(element, msg) {
var tooltipOriginalTitle=element.getAttribute('data-bs-original-title'); var tooltipOriginalTitle = element.getAttribute('data-bs-original-title');
element.setAttribute('data-bs-original-title', msg); element.setAttribute('data-bs-original-title', msg);
$(element).tooltip('show'); $(element).tooltip('show');
element.setAttribute('data-bs-original-title', tooltipOriginalTitle); element.setAttribute('data-bs-original-title', tooltipOriginalTitle);
} }
if(ClipboardJS.isSupported()) { if (ClipboardJS.isSupported()) {
$(document).ready(function() { $(document).ready(function () {
var copyButton = "<button type='button' class='btn btn-primary btn-copy-ex' title='Copy to clipboard' aria-label='Copy to clipboard' data-toggle='tooltip' data-placement='left' data-trigger='hover' data-clipboard-copy><i class='fa fa-copy'></i></button>"; var copyButton = "<button type='button' class='btn btn-primary btn-copy-ex' title='Copy to clipboard' aria-label='Copy to clipboard' data-toggle='tooltip' data-placement='left' data-trigger='hover' data-clipboard-copy><i class='fa fa-copy'></i></button>";
$("div.sourceCode").addClass("hasCopyButton"); $("div.sourceCode").addClass("hasCopyButton");
// Insert copy buttons: // Insert copy buttons:
$(copyButton).prependTo(".hasCopyButton"); $(copyButton).prependTo(".hasCopyButton");
// Initialize tooltips: // Initialize tooltips:
$('.btn-copy-ex').tooltip({container: 'body'}); $('.btn-copy-ex').tooltip({ container: 'body' });
// Initialize clipboard:
var clipboard = new ClipboardJS('[data-clipboard-copy]', {
text: function (trigger) {
return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, "");
}
});
clipboard.on('success', function (e) {
changeTooltipMessage(e.trigger, 'Copied!');
e.clearSelection();
});
clipboard.on('error', function (e) {
changeTooltipMessage(e.trigger, 'Press Ctrl+C or Command+C to copy');
});
// Initialize clipboard:
var clipboard = new ClipboardJS('[data-clipboard-copy]', {
text: function(trigger) {
return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, "");
}
}); });
}
clipboard.on('success', function(e) {
changeTooltipMessage(e.trigger, 'Copied!');
e.clearSelection();
});
clipboard.on('error', function(e) {
changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy');
});
});
}
/* Search marking --------------------------*/ /* Search marking --------------------------*/
var url = new URL(window.location.href); var url = new URL(window.location.href);
@ -80,80 +80,80 @@
}); });
} }
/* Search --------------------------*/ /* Search --------------------------*/
/* Adapted from https://github.com/rstudio/bookdown/blob/2d692ba4b61f1e466c92e78fd712b0ab08c11d31/inst/resources/bs4_book/bs4_book.js#L25 */ /* Adapted from https://github.com/rstudio/bookdown/blob/2d692ba4b61f1e466c92e78fd712b0ab08c11d31/inst/resources/bs4_book/bs4_book.js#L25 */
// Initialise search index on focus // Initialise search index on focus
var fuse; var fuse;
$("#search-input").focus(async function(e) { $("#search-input").focus(async function (e) {
if (fuse) { if (fuse) {
return; return;
} }
$(e.target).addClass("loading"); $(e.target).addClass("loading");
var response = await fetch($("#search-input").data("search-index")); var response = await fetch($("#search-input").data("search-index"));
var data = await response.json(); var data = await response.json();
var options = {
keys: ["what", "text", "code"],
ignoreLocation: true,
threshold: 0.1,
includeMatches: true,
includeScore: true,
};
fuse = new Fuse(data, options);
$(e.target).removeClass("loading");
});
// Use algolia autocomplete
var options = { var options = {
keys: ["what", "text", "code"], autoselect: true,
ignoreLocation: true, debug: true,
threshold: 0.1, hint: false,
includeMatches: true, minLength: 2,
includeScore: true,
}; };
fuse = new Fuse(data, options); var q;
async function searchFuse(query, callback) {
await fuse;
$(e.target).removeClass("loading"); var items;
}); if (!fuse) {
items = [];
// Use algolia autocomplete } else {
var options = { q = query;
autoselect: true, var results = fuse.search(query, { limit: 20 });
debug: true, items = results
hint: false, .filter((x) => x.score <= 0.75)
minLength: 2, .map((x) => x.item);
}; if (items.length === 0) {
var q; items = [{ dir: "Sorry 😿", previous_headings: "", title: "No results found.", what: "No results found.", path: window.location.href }];
async function searchFuse(query, callback) { }
await fuse; }
callback(items);
var items;
if (!fuse) {
items = [];
} else {
q = query;
var results = fuse.search(query, { limit: 20 });
items = results
.filter((x) => x.score <= 0.75)
.map((x) => x.item);
if (items.length === 0) {
items = [{dir:"Sorry 😿",previous_headings:"",title:"No results found.",what:"No results found.",path:window.location.href}];
} }
} $("#search-input").autocomplete(options, [
callback(items); {
} name: "content",
$("#search-input").autocomplete(options, [ source: searchFuse,
{ templates: {
name: "content", suggestion: (s) => {
source: searchFuse, if (s.title == s.what) {
templates: { return `${s.dir} > <div class="search-details"> ${s.title}</div>`;
suggestion: (s) => { } else if (s.previous_headings == "") {
if (s.title == s.what) { return `${s.dir} > <div class="search-details"> ${s.title}</div> > ${s.what}`;
return `${s.dir} > <div class="search-details"> ${s.title}</div>`; } else {
} else if (s.previous_headings == "") { return `${s.dir} > <div class="search-details"> ${s.title}</div> > ${s.previous_headings} > ${s.what}`;
return `${s.dir} > <div class="search-details"> ${s.title}</div> > ${s.what}`; }
} else { },
return `${s.dir} > <div class="search-details"> ${s.title}</div> > ${s.previous_headings} > ${s.what}`;
}
}, },
}, },
}, ]).on('autocomplete:selected', function (event, s) {
]).on('autocomplete:selected', function(event, s) { window.location.href = s.path + "?q=" + q + "#" + s.id;
window.location.href = s.path + "?q=" + q + "#" + s.id; });
});
}); });
})(window.jQuery || window.$) })(window.jQuery || window.$)
document.addEventListener('keydown', function(event) { document.addEventListener('keydown', function (event) {
// Check if the pressed key is '/' // Check if the pressed key is '/'
if (event.key === '/') { if (event.key === '/') {
event.preventDefault(); // Prevent any default action associated with the '/' key event.preventDefault(); // Prevent any default action associated with the '/' key

View file

@ -1,11 +1,11 @@
pandoc: 3.1.11 pandoc: 3.1.11
pkgdown: 2.1.1 pkgdown: 2.2.0
pkgdown_sha: ~ pkgdown_sha: ~
articles: articles:
Database-creation: Database-creation.html Database-creation: Database-creation.html
REDCapCAST: REDCapCAST.html REDCapCAST: REDCapCAST.html
Shiny-app: Shiny-app.html Shiny-app: Shiny-app.html
last_built: 2025-03-11T13:45Z last_built: 2025-11-14T14:10Z
urls: urls:
reference: https://agdamsbo.github.io/REDCapCAST/reference reference: https://agdamsbo.github.io/REDCapCAST/reference
article: https://agdamsbo.github.io/REDCapCAST/articles article: https://agdamsbo.github.io/REDCapCAST/articles

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>REDCapCAST: REDCap Metadata Casting and Castellated Data Handling — REDCapCAST-package • 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="REDCapCAST: REDCap Metadata Casting and Castellated Data Handling — REDCapCAST-package"><meta name="description" content="Casting metadata for REDCap database creation and handling of castellated data using repeated instruments and longitudinal projects in 'REDCap'. Keeps a focused data export approach, by allowing to only export required data from the database. Also for casting new REDCap databases based on datasets from other sources. Originally forked from the R part of 'REDCapRITS' by Paul Egeler. See https://github.com/pegeler/REDCapRITS. 'REDCap' (Research Electronic Data Capture) is a secure, web-based software platform designed to support data capture for research studies, providing 1) an intuitive interface for validated data capture; 2) audit trails for tracking data manipulation and export procedures; 3) automated export procedures for seamless data downloads to common statistical packages; and 4) procedures for data integration and interoperability with external sources (Harris et al (2009) doi:10.1016/j.jbi.2008.08.010 <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>REDCapCAST: REDCap Metadata Casting and Castellated Data Handling — REDCapCAST-package • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="REDCapCAST: REDCap Metadata Casting and Castellated Data Handling — REDCapCAST-package"><meta name="description" content="Casting metadata for REDCap database creation and handling of castellated data using repeated instruments and longitudinal projects in 'REDCap'. Keeps a focused data export approach, by allowing to only export required data from the database. Also for casting new REDCap databases based on datasets from other sources. Originally forked from the R part of 'REDCapRITS' by Paul Egeler. See https://github.com/pegeler/REDCapRITS. 'REDCap' (Research Electronic Data Capture) is a secure, web-based software platform designed to support data capture for research studies, providing 1) an intuitive interface for validated data capture; 2) audit trails for tracking data manipulation and export procedures; 3) automated export procedures for seamless data downloads to common statistical packages; and 4) procedures for data integration and interoperability with external sources (Harris et al (2009) doi:10.1016/j.jbi.2008.08.010
; Harris et al (2019) doi:10.1016/j.jbi.2019.103208 ; Harris et al (2019) doi:10.1016/j.jbi.2019.103208
)."><meta property="og:description" content="Casting metadata for REDCap database creation and handling of castellated data using repeated instruments and longitudinal projects in 'REDCap'. Keeps a focused data export approach, by allowing to only export required data from the database. Also for casting new REDCap databases based on datasets from other sources. Originally forked from the R part of 'REDCapRITS' by Paul Egeler. See https://github.com/pegeler/REDCapRITS. 'REDCap' (Research Electronic Data Capture) is a secure, web-based software platform designed to support data capture for research studies, providing 1) an intuitive interface for validated data capture; 2) audit trails for tracking data manipulation and export procedures; 3) automated export procedures for seamless data downloads to common statistical packages; and 4) procedures for data integration and interoperability with external sources (Harris et al (2009) doi:10.1016/j.jbi.2008.08.010 )."><meta property="og:description" content="Casting metadata for REDCap database creation and handling of castellated data using repeated instruments and longitudinal projects in 'REDCap'. Keeps a focused data export approach, by allowing to only export required data from the database. Also for casting new REDCap databases based on datasets from other sources. Originally forked from the R part of 'REDCapRITS' by Paul Egeler. See https://github.com/pegeler/REDCapRITS. 'REDCap' (Research Electronic Data Capture) is a secure, web-based software platform designed to support data capture for research studies, providing 1) an intuitive interface for validated data capture; 2) audit trails for tracking data manipulation and export procedures; 3) automated export procedures for seamless data downloads to common statistical packages; and 4) procedures for data integration and interoperability with external sources (Harris et al (2009) doi:10.1016/j.jbi.2008.08.010
; Harris et al (2019) doi:10.1016/j.jbi.2019.103208 ; Harris et al (2019) doi:10.1016/j.jbi.2019.103208
@ -11,7 +11,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -39,7 +39,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>REDCapCAST: REDCap Metadata Casting and Castellated Data Handling</h1> <h1>REDCapCAST: REDCap Metadata Casting and Castellated Data Handling</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/REDCapCAST-package.R" class="external-link"><code>R/REDCapCAST-package.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/REDCapCAST-package.R" class="external-link"><code>R/REDCapCAST-package.R</code></a></small>
<div class="d-none name"><code>REDCapCAST-package.Rd</code></div> <div class="d-none name"><code>REDCapCAST-package.Rd</code></div>
</div> </div>
@ -72,7 +72,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,40 @@
# REDCapCAST: REDCap Metadata Casting and Castellated Data Handling
Casting metadata for REDCap database creation and handling of
castellated data using repeated instruments and longitudinal projects in
'REDCap'. Keeps a focused data export approach, by allowing to only
export required data from the database. Also for casting new REDCap
databases based on datasets from other sources. Originally forked from
the R part of 'REDCapRITS' by Paul Egeler. See
<https://github.com/pegeler/REDCapRITS>. 'REDCap' (Research Electronic
Data Capture) is a secure, web-based software platform designed to
support data capture for research studies, providing 1) an intuitive
interface for validated data capture; 2) audit trails for tracking data
manipulation and export procedures; 3) automated export procedures for
seamless data downloads to common statistical packages; and 4)
procedures for data integration and interoperability with external
sources (Harris et al (2009)
[doi:10.1016/j.jbi.2008.08.010](https://doi.org/10.1016/j.jbi.2008.08.010)
; Harris et al (2019)
[doi:10.1016/j.jbi.2019.103208](https://doi.org/10.1016/j.jbi.2019.103208)
).
## See also
Useful links:
- <https://github.com/agdamsbo/REDCapCAST>
- <https://agdamsbo.github.io/REDCapCAST/>
- Report bugs at <https://github.com/agdamsbo/REDCapCAST/issues>
## Author
**Maintainer**: Andreas Gammelgaard Damsbo <agdamsbo@clin.au.dk>
([ORCID](https://orcid.org/0000-0002-7559-1154))
Authors:
- Paul Egeler <paulegeler@gmail.com>
([ORCID](https://orcid.org/0000-0001-6948-9498))

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Split REDCap repeating instruments table into multiple tables — REDCap_split • 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="Split REDCap repeating instruments table into multiple tables — REDCap_split"><meta name="description" content="This will take output from a REDCap export and split it into a base table <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Split REDCap repeating instruments table into multiple tables — REDCap_split • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Split REDCap repeating instruments table into multiple tables — REDCap_split"><meta name="description" content="This will take output from a REDCap export and split it into a base table
and child tables for each repeating instrument. Metadata and child tables for each repeating instrument. Metadata
is used to determine which fields should be included in each resultant table."><meta property="og:description" content="This will take output from a REDCap export and split it into a base table is used to determine which fields should be included in each resultant table."><meta property="og:description" content="This will take output from a REDCap export and split it into a base table
and child tables for each repeating instrument. Metadata and child tables for each repeating instrument. Metadata
@ -11,7 +11,7 @@ is used to determine which fields should be included in each resultant table."><
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -39,7 +39,7 @@ is used to determine which fields should be included in each resultant table."><
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Split REDCap repeating instruments table into multiple tables</h1> <h1>Split REDCap repeating instruments table into multiple tables</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/REDCap_split.r" class="external-link"><code>R/REDCap_split.r</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/REDCap_split.r" class="external-link"><code>R/REDCap_split.r</code></a></small>
<div class="d-none name"><code>REDCap_split.Rd</code></div> <div class="d-none name"><code>REDCap_split.Rd</code></div>
</div> </div>
@ -167,7 +167,7 @@ instruments only or for all forms.</p></dd>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

114
reference/REDCap_split.md Normal file
View file

@ -0,0 +1,114 @@
# Split REDCap repeating instruments table into multiple tables
This will take output from a REDCap export and split it into a base
table and child tables for each repeating instrument. Metadata is used
to determine which fields should be included in each resultant table.
## Usage
``` r
REDCap_split(
records,
metadata,
primary_table_name = "",
forms = c("repeating", "all")
)
```
## Arguments
- records:
Exported project records. May be a `data.frame`, `response`, or
`character` vector containing JSON from an API call.
- metadata:
Project metadata (the data dictionary). May be a `data.frame`,
`response`, or `character` vector containing JSON from an API call.
- primary_table_name:
Name given to the list element for the primary output table. Ignored
if `forms = 'all'`.
- forms:
Indicate whether to create separate tables for repeating instruments
only or for all forms.
## Value
A list of `"data.frame"`s. The number of tables will differ depending on
the `forms` option selected.
- `'repeating'`: one base table and one or more tables for each
repeating instrument.
- `'all'`: a data.frame for each instrument, regardless of whether it is
a repeating instrument or not.
## Author
Paul W. Egeler
## Examples
``` r
if (FALSE) { # \dontrun{
# Using an API call -------------------------------------------------------
library(RCurl)
# Get the records
records <- postForm(
uri = api_url, # Supply your site-specific URI
token = api_token, # Supply your own API token
content = "record",
format = "json",
returnFormat = "json"
)
# Get the metadata
metadata <- postForm(
uri = api_url, # Supply your site-specific URI
token = api_token, # Supply your own API token
content = "metadata",
format = "json"
)
# Convert exported JSON strings into a list of data.frames
REDCapCAST::REDCap_split(records, metadata)
# Using a raw data export -------------------------------------------------
# Get the records
records <- read.csv("/path/to/data/ExampleProject_DATA_2018-06-03_1700.csv")
# Get the metadata
metadata <- read.csv(
"/path/to/data/ExampleProject_DataDictionary_2018-06-03.csv"
)
# Split the tables
REDCapCAST::REDCap_split(records, metadata)
# In conjunction with the R export script ---------------------------------
# You must set the working directory first since the REDCap data export
# script contains relative file references.
old <- getwd()
setwd("/path/to/data/")
# Run the data export script supplied by REDCap.
# This will create a data.frame of your records called 'data'
source("ExampleProject_R_2018-06-03_1700.r")
# Get the metadatan
metadata <- read.csv("ExampleProject_DataDictionary_2018-06-03.csv")
# Split the tables
REDCapCAST::REDCap_split(data, metadata)
setwd(old)
} # }
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Check if vector is all NA — all_na • 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="Check if vector is all NA — all_na"><meta name="description" content="Check if vector is all NA"><meta property="og:description" content="Check if vector is all NA"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Check if vector is all NA — all_na • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Check if vector is all NA — all_na"><meta name="description" content="Check if vector is all NA"><meta property="og:description" content="Check if vector is all NA"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Check if vector is all NA</h1> <h1>Check if vector is all NA</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/ds2dd_detailed.R" class="external-link"><code>R/ds2dd_detailed.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>all_na.Rd</code></div> <div class="d-none name"><code>all_na.Rd</code></div>
</div> </div>
@ -76,7 +76,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

26
reference/all_na.md Normal file
View file

@ -0,0 +1,26 @@
# Check if vector is all NA
Check if vector is all NA
## Usage
``` r
all_na(data)
```
## Arguments
- data:
vector of data.frame
## Value
logical
## Examples
``` r
rep(NA, 4) |> all_na()
#> [1] TRUE
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Preserve all factor levels from REDCap data dictionary in data export — apply_factor_labels • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Preserve all factor levels from REDCap data dictionary in data export — apply_factor_labels"><meta name="description" content="Preserve all factor levels from REDCap data dictionary in data export"><meta property="og:description" content="Preserve all factor levels from REDCap data dictionary in data export"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Preserve all factor levels from REDCap data dictionary in data export — apply_factor_labels • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Preserve all factor levels from REDCap data dictionary in data export — apply_factor_labels"><meta name="description" content="Preserve all factor levels from REDCap data dictionary in data export"><meta property="og:description" content="Preserve all factor levels from REDCap data dictionary in data export"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Preserve all factor levels from REDCap data dictionary in data export</h1> <h1>Preserve all factor levels from REDCap data dictionary in data export</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/read_redcap_tables.R" class="external-link"><code>R/read_redcap_tables.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/read_redcap_tables.R" class="external-link"><code>R/read_redcap_tables.R</code></a></small>
<div class="d-none name"><code>apply_factor_labels.Rd</code></div> <div class="d-none name"><code>apply_factor_labels.Rd</code></div>
</div> </div>
@ -74,7 +74,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,23 @@
# Preserve all factor levels from REDCap data dictionary in data export
Preserve all factor levels from REDCap data dictionary in data export
## Usage
``` r
apply_factor_labels(data, meta = NULL)
```
## Arguments
- data:
REDCap exported data set
- meta:
REDCap data dictionary
## Value
data.frame

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Apply REDCap filed labels to data frame — apply_field_label • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Apply REDCap filed labels to data frame — apply_field_label"><meta name="description" content="Apply REDCap filed labels to data frame"><meta property="og:description" content="Apply REDCap filed labels to data frame"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Apply REDCap filed labels to data frame — apply_field_label • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Apply REDCap filed labels to data frame — apply_field_label"><meta name="description" content="Apply REDCap filed labels to data frame"><meta property="og:description" content="Apply REDCap filed labels to data frame"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Apply REDCap filed labels to data frame</h1> <h1>Apply REDCap filed labels to data frame</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/read_redcap_tables.R" class="external-link"><code>R/read_redcap_tables.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/read_redcap_tables.R" class="external-link"><code>R/read_redcap_tables.R</code></a></small>
<div class="d-none name"><code>apply_field_label.Rd</code></div> <div class="d-none name"><code>apply_field_label.Rd</code></div>
</div> </div>
@ -74,7 +74,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,23 @@
# Apply REDCap filed labels to data frame
Apply REDCap filed labels to data frame
## Usage
``` r
apply_field_label(data, meta)
```
## Arguments
- data:
REDCap exported data set
- meta:
REDCap data dictionary
## Value
data.frame

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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 as_factor as well as as_factor, by appending <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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 as_factor as well as as_factor, by appending
original attributes except for "class" after converting to factor to avoid 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 as_factor as well as as_factor, by appending ta loss in case of rich formatted and labelled data.'><meta property="og:description" content='This extends as_factor as well as as_factor, by appending
original attributes except for "class" after converting to factor to avoid original attributes except for "class" after converting to factor to avoid
@ -11,7 +11,7 @@ ta loss in case of rich formatted and labelled data.'></head><body>
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -39,7 +39,7 @@ ta loss in case of rich formatted and labelled data.'></head><body>
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Convert labelled vectors to factors while preserving attributes</h1> <h1>Convert labelled vectors to factors while preserving attributes</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/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/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 class="d-none name"><code>as_factor.Rd</code></div>
</div> </div>
@ -165,7 +165,7 @@ To avoid redundancy calls and errors, functions are copy-pasted here</p>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

114
reference/as_factor.md Normal file
View file

@ -0,0 +1,114 @@
# Convert labelled vectors to factors while preserving attributes
This extends
[as_factor](https://forcats.tidyverse.org/reference/as_factor.html) as
well as
[as_factor](https://forcats.tidyverse.org/reference/as_factor.html), by
appending original attributes except for "class" after converting to
factor to avoid ta loss in case of rich formatted and labelled data.
## Usage
``` r
as_factor(x, ...)
# S3 method for class 'factor'
as_factor(x, ...)
# S3 method for class 'logical'
as_factor(x, ...)
# S3 method for class 'numeric'
as_factor(x, ...)
# S3 method for class 'character'
as_factor(x, ...)
# S3 method for class 'haven_labelled'
as_factor(
x,
levels = c("default", "labels", "values", "both"),
ordered = FALSE,
...
)
# S3 method for class 'labelled'
as_factor(
x,
levels = c("default", "labels", "values", "both"),
ordered = FALSE,
...
)
# S3 method for class 'data.frame'
as_factor(x, ..., only_labelled = TRUE)
```
## Arguments
- x:
Object to coerce to a factor.
- ...:
Other arguments passed down to method.
- levels:
How to create the levels of the generated factor:
\* "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
- ordered:
If \`TRUE\` create an ordered (ordinal) factor, if \`FALSE\` (the
default) create a regular (nominal) factor.
- only_labelled:
Only apply to labelled columns?
## Details
Please refer to parent functions for extended documentation. To avoid
redundancy calls and errors, functions are copy-pasted here
Empty variables with empty levels attribute are interpreted as logicals
## Examples
``` r
# will preserve all attributes
c(1, 4, 3, "A", 7, 8, 1) |> as_factor()
#> [1] 1 4 3 A 7 8 1
#> Levels: 1 4 3 A 7 8
structure(c(1, 2, 3, 2, 10, 9),
labels = c(Unknown = 9, Refused = 10)
) |>
as_factor() |>
dput()
#> structure(c(1L, 2L, 3L, 2L, 5L, 4L), levels = c("1", "2", "3",
#> "9", "10"), class = "factor", labels = c(Unknown = 9, Refused = 10
#> ))
structure(c(1, 2, 3, 2, 10, 9),
labels = c(Unknown = 9, Refused = 10),
class = "haven_labelled"
) |>
as_factor() |> class()
#> [1] "factor"
structure(rep(NA,10),
class = c("labelled")
) |>
as_factor() |> summary()
#> FALSE TRUE NA's
#> 0 0 10
rep(NA,10) |> as_factor()
#> [1] <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>
#> Levels: FALSE TRUE
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Interpret specific binary values as logicals — as_logical • 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="Interpret specific binary values as logicals — as_logical"><meta name="description" content="Interpret specific binary values as logicals"><meta property="og:description" content="Interpret specific binary values as logicals"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Interpret specific binary values as logicals — as_logical • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Interpret specific binary values as logicals — as_logical"><meta name="description" content="Interpret specific binary values as logicals"><meta property="og:description" content="Interpret specific binary values as logicals"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Interpret specific binary values as logicals</h1> <h1>Interpret specific binary values as logicals</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/as_logical.R" class="external-link"><code>R/as_logical.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/as_logical.R" class="external-link"><code>R/as_logical.R</code></a></small>
<div class="d-none name"><code>as_logical.Rd</code></div> <div class="d-none name"><code>as_logical.Rd</code></div>
</div> </div>
@ -109,8 +109,8 @@ interpreted as TRUE.</p></dd>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] "factor"</span> <span class="r-out co"><span class="r-pr">#&gt;</span> [1] "factor"</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/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"TRUE"</span>,<span class="cn">NA</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"><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">"TRUE"</span>,<span class="cn">NA</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">as_logical</span><span class="op">(</span><span class="op">)</span></span></span> <span class="r-in"><span> <span class="fu">as_logical</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] NA NA TRUE NA NA NA NA NA TRUE TRUE TRUE NA TRUE TRUE TRUE</span> <span class="r-out co"><span class="r-pr">#&gt;</span> [1] TRUE TRUE TRUE NA TRUE TRUE TRUE TRUE NA TRUE TRUE TRUE NA NA TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [16] TRUE NA TRUE TRUE TRUE</span> <span class="r-out co"><span class="r-pr">#&gt;</span> [16] TRUE TRUE TRUE NA TRUE</span>
<span class="r-in"><span><span class="fu">as_logical</span><span class="op">(</span><span class="fl">0</span><span class="op">)</span></span></span> <span class="r-in"><span><span class="fu">as_logical</span><span class="op">(</span><span class="fl">0</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] FALSE</span> <span class="r-out co"><span class="r-pr">#&gt;</span> [1] FALSE</span>
</code></pre></div> </code></pre></div>
@ -124,7 +124,7 @@ interpreted as TRUE.</p></dd>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

73
reference/as_logical.md Normal file
View file

@ -0,0 +1,73 @@
# Interpret specific binary values as logicals
Interpret specific binary values as logicals
## Usage
``` r
as_logical(
x,
values = list(c("TRUE", "FALSE"), c("Yes", "No"), c(1, 0), c(1, 2)),
...
)
# S3 method for class 'data.frame'
as_logical(
x,
values = list(c("TRUE", "FALSE"), c("Yes", "No"), c(1, 0), c(1, 2)),
...
)
# Default S3 method
as_logical(
x,
values = list(c("TRUE", "FALSE"), c("Yes", "No"), c(1, 0), c(1, 2)),
...
)
```
## Arguments
- x:
vector or data.frame
- values:
list of values to interpret as logicals. First value is
- ...:
ignored interpreted as TRUE.
## Value
vector
## Examples
``` r
c(sample(c("TRUE", "FALSE"), 20, TRUE), NA) |>
as_logical() |>
class()
#> [1] "logical"
ds <- dplyr::tibble(
B = factor(sample(c(1, 2), 20, TRUE)),
A = factor(sample(c("TRUE", "FALSE"), 20, TRUE)),
C = sample(c(3, 4), 20, TRUE),
D = factor(sample(c("In", "Out"), 20, TRUE))
)
ds |>
as_logical() |>
sapply(class)
#> B A C D
#> "logical" "logical" "numeric" "factor"
ds$A |> class()
#> [1] "factor"
sample(c("TRUE",NA), 20, TRUE) |>
as_logical()
#> [1] TRUE TRUE TRUE NA TRUE TRUE TRUE TRUE NA TRUE TRUE TRUE NA NA TRUE
#> [16] TRUE TRUE TRUE NA TRUE
as_logical(0)
#> [1] FALSE
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>List-base regex case_when — case_match_regex_list • 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="List-base regex case_when — case_match_regex_list"><meta name="description" content="Mimics case_when for list of regex patterns and values. Used for date/time <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>List-base regex case_when — case_match_regex_list • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="List-base regex case_when — case_match_regex_list"><meta name="description" content="Mimics case_when for list of regex patterns and values. Used for date/time
validation generation from name vector. Like case_when, the matches are in validation generation from name vector. Like case_when, the matches are in
order of priority. order of priority.
Primarily used in REDCapCAST to do data type coding from systematic variable Primarily used in REDCapCAST to do data type coding from systematic variable
@ -15,7 +15,7 @@ naming."></head><body>
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -43,7 +43,7 @@ naming."></head><body>
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>List-base regex case_when</h1> <h1>List-base regex case_when</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/doc2dd.R" class="external-link"><code>R/doc2dd.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/doc2dd.R" class="external-link"><code>R/doc2dd.R</code></a></small>
<div class="d-none name"><code>case_match_regex_list.Rd</code></div> <div class="d-none name"><code>case_match_regex_list.Rd</code></div>
</div> </div>
@ -99,7 +99,7 @@ naming.</p>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,40 @@
# List-base regex case_when
Mimics case_when for list of regex patterns and values. Used for
date/time validation generation from name vector. Like case_when, the
matches are in order of priority. Primarily used in REDCapCAST to do
data type coding from systematic variable naming.
## Usage
``` r
case_match_regex_list(data, match.list, .default = NA)
```
## Arguments
- data:
vector
- match.list:
list of case matches
- .default:
Default value for non-matches. Default is NA.
## Value
vector
## Examples
``` r
case_match_regex_list(
c("test_date", "test_time", "test_tida", "test_tid"),
list(date_dmy = "_dat[eo]$", time_hh_mm_ss = "_ti[md]e?$")
)
#> [1] "date_dmy" "time_hh_mm_ss" NA "time_hh_mm_ss"
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Overview of REDCapCAST data for shiny</h1> <h1>Overview of REDCapCAST data for shiny</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/shiny_cast.R" class="external-link"><code>R/shiny_cast.R</code></a></small> <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 class="d-none name"><code>cast_data_overview.Rd</code></div>
</div> </div>
@ -70,7 +70,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,19 @@
# Overview of REDCapCAST data for shiny
Overview of REDCapCAST data for shiny
## Usage
``` r
cast_data_overview(data)
```
## Arguments
- data:
list with class 'REDCapCAST'
## Value
gt object

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Overview of REDCapCAST meta data for shiny</h1> <h1>Overview of REDCapCAST meta data for shiny</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/shiny_cast.R" class="external-link"><code>R/shiny_cast.R</code></a></small> <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 class="d-none name"><code>cast_meta_overview.Rd</code></div>
</div> </div>
@ -70,7 +70,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,19 @@
# Overview of REDCapCAST meta data for shiny
Overview of REDCapCAST meta data for shiny
## Usage
``` r
cast_meta_overview(data)
```
## Arguments
- data:
list with class 'REDCapCAST'
## Value
gt object

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Simple function to generate REDCap choices from character vector — char2choice • 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="Simple function to generate REDCap choices from character vector — char2choice"><meta name="description" content="Simple function to generate REDCap choices from character vector"><meta property="og:description" content="Simple function to generate REDCap choices from character vector"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Simple function to generate REDCap choices from character vector — char2choice • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Simple function to generate REDCap choices from character vector — char2choice"><meta name="description" content="Simple function to generate REDCap choices from character vector"><meta property="og:description" content="Simple function to generate REDCap choices from character vector"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Simple function to generate REDCap choices from character vector</h1> <h1>Simple function to generate REDCap choices from character vector</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/doc2dd.R" class="external-link"><code>R/doc2dd.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/doc2dd.R" class="external-link"><code>R/doc2dd.R</code></a></small>
<div class="d-none name"><code>char2choice.Rd</code></div> <div class="d-none name"><code>char2choice.Rd</code></div>
</div> </div>
@ -89,7 +89,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

39
reference/char2choice.md Normal file
View file

@ -0,0 +1,39 @@
# Simple function to generate REDCap choices from character vector
Simple function to generate REDCap choices from character vector
## Usage
``` r
char2choice(data, char.split = "/", raw = NULL, .default = NA)
```
## Arguments
- data:
vector
- char.split:
splitting character(s)
- raw:
specific values. Can be used for options of same length.
- .default:
default value for missing. Default is NA.
## Value
vector
## Examples
``` r
char2choice(c("yes/no"," yep. / nope ","",NA,"what"),.default=NA)
#> [1] "1, yes | 2, no" "1, yep. | 2, nope" NA
#> [4] NA "1, what"
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Simple function to generate REDCap branching logic from character vector — char2cond • 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="Simple function to generate REDCap branching logic from character vector — char2cond"><meta name="description" content="Simple function to generate REDCap branching logic from character vector"><meta property="og:description" content="Simple function to generate REDCap branching logic from character vector"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Simple function to generate REDCap branching logic from character vector — char2cond • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Simple function to generate REDCap branching logic from character vector — char2cond"><meta name="description" content="Simple function to generate REDCap branching logic from character vector"><meta property="og:description" content="Simple function to generate REDCap branching logic from character vector"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Simple function to generate REDCap branching logic from character vector</h1> <h1>Simple function to generate REDCap branching logic from character vector</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/doc2dd.R" class="external-link"><code>R/doc2dd.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/doc2dd.R" class="external-link"><code>R/doc2dd.R</code></a></small>
<div class="d-none name"><code>char2cond.Rd</code></div> <div class="d-none name"><code>char2cond.Rd</code></div>
</div> </div>
@ -98,7 +98,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

48
reference/char2cond.md Normal file
View file

@ -0,0 +1,48 @@
# Simple function to generate REDCap branching logic from character vector
Simple function to generate REDCap branching logic from character vector
## Usage
``` r
char2cond(
data,
minor.split = ",",
major.split = ";",
major.sep = " or ",
.default = NA
)
```
## Arguments
- data:
vector
- minor.split:
minor split
- major.split:
major split
- major.sep:
argument separation. Default is " or ".
- .default:
default value for missing. Default is NA.
## Value
vector
## Examples
``` r
#data <- dd_inst$betingelse
#c("Extubation_novent, 2; Pacu_delay, 1") |> char2cond()
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Very simple function to remove rich text formatting from field label and save the first paragraph ('&lt;p&gt;...&lt;/p&gt;'). — clean_field_label • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Very simple function to remove rich text formatting from field label and save the first paragraph ('&lt;p&gt;...&lt;/p&gt;'). — clean_field_label"><meta name="description" content="Very simple function to remove rich text formatting from field label <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Very simple function to remove rich text formatting from field label and save the first paragraph ('&lt;p&gt;...&lt;/p&gt;'). — clean_field_label • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Very simple function to remove rich text formatting from field label and save the first paragraph ('&lt;p&gt;...&lt;/p&gt;'). — clean_field_label"><meta name="description" content="Very simple function to remove rich text formatting from field label
and save the first paragraph ('&amp;lt;p&amp;gt;...&amp;lt;/p&amp;gt;')."><meta property="og:description" content="Very simple function to remove rich text formatting from field label and save the first paragraph ('&amp;lt;p&amp;gt;...&amp;lt;/p&amp;gt;')."><meta property="og:description" content="Very simple function to remove rich text formatting from field label
and save the first paragraph ('&amp;lt;p&amp;gt;...&amp;lt;/p&amp;gt;')."></head><body> and save the first paragraph ('&amp;lt;p&amp;gt;...&amp;lt;/p&amp;gt;')."></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -9,7 +9,7 @@ and save the first paragraph ('&amp;lt;p&amp;gt;...&amp;lt;/p&amp;gt;')."></head
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -37,7 +37,7 @@ and save the first paragraph ('&amp;lt;p&amp;gt;...&amp;lt;/p&amp;gt;')."></head
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Very simple function to remove rich text formatting from field label and save the first paragraph ('&lt;p&gt;...&lt;/p&gt;').</h1> <h1>Very simple function to remove rich text formatting from field label and save the first paragraph ('&lt;p&gt;...&lt;/p&gt;').</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/read_redcap_tables.R" class="external-link"><code>R/read_redcap_tables.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/read_redcap_tables.R" class="external-link"><code>R/read_redcap_tables.R</code></a></small>
<div class="d-none name"><code>clean_field_label.Rd</code></div> <div class="d-none name"><code>clean_field_label.Rd</code></div>
</div> </div>
@ -79,7 +79,7 @@ and save the first paragraph ('&lt;p&gt;...&lt;/p&gt;').</p>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,27 @@
# Very simple function to remove rich text formatting from field label and save the first paragraph ('\<p\>...\</p\>').
Very simple function to remove rich text formatting from field label and
save the first paragraph ('\<p\>...\</p\>').
## Usage
``` r
clean_field_label(data)
```
## Arguments
- data:
field label
## Value
character vector
## Examples
``` r
clean_field_label("<div class=\"rich-text-field-label\"><p>Fazekas score</p></div>")
#> [1] "Fazekas score"
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>clean_redcap_name — clean_redcap_name • 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="clean_redcap_name — clean_redcap_name"><meta name="description" content="Stepwise removal on non-alphanumeric characters, trailing white space, <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>clean_redcap_name — clean_redcap_name • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="clean_redcap_name — clean_redcap_name"><meta name="description" content="Stepwise removal on non-alphanumeric characters, trailing white space,
substitutes spaces for underscores and converts to lower case. substitutes spaces for underscores and converts to lower case.
Trying to make up for different naming conventions."><meta property="og:description" content="Stepwise removal on non-alphanumeric characters, trailing white space, Trying to make up for different naming conventions."><meta property="og:description" content="Stepwise removal on non-alphanumeric characters, trailing white space,
substitutes spaces for underscores and converts to lower case. substitutes spaces for underscores and converts to lower case.
@ -11,7 +11,7 @@ Trying to make up for different naming conventions."></head><body>
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -39,7 +39,7 @@ Trying to make up for different naming conventions."></head><body>
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>clean_redcap_name</h1> <h1>clean_redcap_name</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/utils.r" class="external-link"><code>R/utils.r</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/utils.r" class="external-link"><code>R/utils.r</code></a></small>
<div class="d-none name"><code>clean_redcap_name.Rd</code></div> <div class="d-none name"><code>clean_redcap_name.Rd</code></div>
</div> </div>
@ -82,7 +82,7 @@ Trying to make up for different naming conventions.</p>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,28 @@
# clean_redcap_name
Stepwise removal on non-alphanumeric characters, trailing white space,
substitutes spaces for underscores and converts to lower case. Trying to
make up for different naming conventions.
## Usage
``` r
clean_redcap_name(x)
```
## Arguments
- x:
vector or data frame for cleaning
## Value
vector or data frame, same format as input
## Examples
``` r
"Research!, ne:ws? and c;l-.ls" |> clean_redcap_name()
#> [1] "research_news_and_clls"
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Compacting a vector of any length with or without names — compact_vec • 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="Compacting a vector of any length with or without names — compact_vec"><meta name="description" content="Compacting a vector of any length with or without names"><meta property="og:description" content="Compacting a vector of any length with or without names"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Compacting a vector of any length with or without names — compact_vec • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Compacting a vector of any length with or without names — compact_vec"><meta name="description" content="Compacting a vector of any length with or without names"><meta property="og:description" content="Compacting a vector of any length with or without names"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Compacting a vector of any length with or without names</h1> <h1>Compacting a vector of any length with or without names</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/ds2dd_detailed.R" class="external-link"><code>R/ds2dd_detailed.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>compact_vec.Rd</code></div> <div class="d-none name"><code>compact_vec.Rd</code></div>
</div> </div>
@ -82,7 +82,7 @@
<span class="r-in"><span><span class="st">"test"</span> <span class="op">|&gt;</span> <span class="fu">compact_vec</span><span class="op">(</span><span class="op">)</span></span></span> <span class="r-in"><span><span class="st">"test"</span> <span class="op">|&gt;</span> <span class="fu">compact_vec</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] "test"</span> <span class="r-out co"><span class="r-pr">#&gt;</span> [1] "test"</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">9</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">compact_vec</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/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">9</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">compact_vec</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] "i; e; c; b; g; d; d; b; i; b; c; c; a; g; e; d; a; c; g; a"</span> <span class="r-out co"><span class="r-pr">#&gt;</span> [1] "g; e; d; a; c; g; a; f; g; h; f; a; d; b; f; e; c; d; f; b"</span>
</code></pre></div> </code></pre></div>
</div> </div>
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2> </main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
@ -94,7 +94,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

44
reference/compact_vec.md Normal file
View file

@ -0,0 +1,44 @@
# Compacting a vector of any length with or without names
Compacting a vector of any length with or without names
## Usage
``` r
compact_vec(data, nm.sep = ": ", val.sep = "; ")
```
## Arguments
- data:
vector, optionally named
- nm.sep:
string separating name from value if any
- val.sep:
string separating values
## Value
character string
## Examples
``` r
sample(seq_len(4), 20, TRUE) |>
as_factor() |>
named_levels() |>
sort() |>
compact_vec()
#> [1] "1: 1; 2: 2; 3: 3; 4: 4"
1:6 |> compact_vec()
#> [1] "1; 2; 3; 4; 5; 6"
"test" |> compact_vec()
#> [1] "test"
sample(letters[1:9], 20, TRUE) |> compact_vec()
#> [1] "g; e; d; a; c; g; a; f; g; h; f; a; d; b; f; e; c; d; f; b"
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Create two-column HTML table for data piping in REDCap instruments — create_html_table • 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="Create two-column HTML table for data piping in REDCap instruments — create_html_table"><meta name="description" content="Create two-column HTML table for data piping in REDCap instruments"><meta property="og:description" content="Create two-column HTML table for data piping in REDCap instruments"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Create two-column HTML table for data piping in REDCap instruments — create_html_table • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Create two-column HTML table for data piping in REDCap instruments — create_html_table"><meta name="description" content="Create two-column HTML table for data piping in REDCap instruments"><meta property="og:description" content="Create two-column HTML table for data piping in REDCap instruments"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Create two-column HTML table for data piping in REDCap instruments</h1> <h1>Create two-column HTML table for data piping in REDCap instruments</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/html_styling.R" class="external-link"><code>R/html_styling.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/html_styling.R" class="external-link"><code>R/html_styling.R</code></a></small>
<div class="d-none name"><code>create_html_table.Rd</code></div> <div class="d-none name"><code>create_html_table.Rd</code></div>
</div> </div>
@ -83,7 +83,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,33 @@
# Create two-column HTML table for data piping in REDCap instruments
Create two-column HTML table for data piping in REDCap instruments
## Usage
``` r
create_html_table(text, variable)
```
## Arguments
- text:
descriptive text
- variable:
variable to pipe
## Value
character vector
## Examples
``` r
create_html_table(text = "Patient ID", variable = c("[cpr]"))
#> <table style="border-collapse: collapse; width: 100%;" border="0"> <tbody><tr> <td style="width: 58%;"> <h5><span style="font-weight: normal;">Patient ID<br /></span></h5> </td> <td style="width: 42%; text-align: left;"> <h5><span style="font-weight: bold;">[cpr]</span></h5> </td> </tr></tbody> </table>
create_html_table(text = paste("assessor", 1:2, sep = "_"), variable = c("[cpr]"))
#> <table style="border-collapse: collapse; width: 100%;" border="0"> <tbody><tr> <td style="width: 58%;"> <h5><span style="font-weight: normal;">assessor_1<br /></span></h5> </td> <td style="width: 42%; text-align: left;"> <h5><span style="font-weight: bold;">[cpr]</span></h5> </td> </tr><tr> <td style="width: 58%;"> <h5><span style="font-weight: normal;">assessor_2<br /></span></h5> </td> <td style="width: 42%; text-align: left;"> <h5><span style="font-weight: bold;">[cpr]</span></h5> </td> </tr></tbody> </table>
# create_html_table(text = c("CPR nummer","Word"), variable = c("[cpr][1]", "[cpr][2]", "[test]"))
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>DEPRICATED Create zips file with necessary content based on data set — create_instrument_meta • 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="DEPRICATED Create zips file with necessary content based on data set — create_instrument_meta"><meta name="description" content="Metadata can be added by editing the data dictionary of a project in the <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>DEPRICATED Create zips file with necessary content based on data set — create_instrument_meta • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="DEPRICATED Create zips file with necessary content based on data set — create_instrument_meta"><meta name="description" content="Metadata can be added by editing the data dictionary of a project in the
initial design phase. If you want to later add new instruments, this initial design phase. If you want to later add new instruments, this
function can be used to create (an) instrument(s) to add to a project in function can be used to create (an) instrument(s) to add to a project in
production."><meta property="og:description" content="Metadata can be added by editing the data dictionary of a project in the production."><meta property="og:description" content="Metadata can be added by editing the data dictionary of a project in the
@ -13,7 +13,7 @@ production."></head><body>
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -41,7 +41,7 @@ production."></head><body>
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>DEPRICATED Create zips file with necessary content based on data set</h1> <h1>DEPRICATED Create zips file with necessary content based on data set</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/export_redcap_instrument.R" class="external-link"><code>R/export_redcap_instrument.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/export_redcap_instrument.R" class="external-link"><code>R/export_redcap_instrument.R</code></a></small>
<div class="d-none name"><code>create_instrument_meta.Rd</code></div> <div class="d-none name"><code>create_instrument_meta.Rd</code></div>
</div> </div>
@ -54,7 +54,7 @@ production.</p>
<div class="section level2"> <div class="section level2">
<h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2> <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">create_instrument_meta</span><span class="op">(</span><span class="va">data</span>, dir <span class="op">=</span> <span class="fu">here</span><span class="fu">::</span><span class="fu"><a href="https://here.r-lib.org//reference/here.html" class="external-link">here</a></span><span class="op">(</span><span class="st">""</span><span class="op">)</span>, record.id <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></code></pre></div> <div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">create_instrument_meta</span><span class="op">(</span><span class="va">data</span>, dir <span class="op">=</span> <span class="fu">here</span><span class="fu">::</span><span class="fu"><a href="https://here.r-lib.org/reference/here.html" class="external-link">here</a></span><span class="op">(</span><span class="st">""</span><span class="op">)</span>, record.id <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></code></pre></div>
</div> </div>
<div class="section level2"> <div class="section level2">
@ -117,7 +117,7 @@ Default is TRUE.</p></dd>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,61 @@
# DEPRICATED Create zips file with necessary content based on data set
Metadata can be added by editing the data dictionary of a project in the
initial design phase. If you want to later add new instruments, this
function can be used to create (an) instrument(s) to add to a project in
production.
## Usage
``` r
create_instrument_meta(data, dir = here::here(""), record.id = TRUE)
```
## Arguments
- data:
metadata for the relevant instrument. Could be from
\`ds2dd_detailed()\`
- dir:
destination dir for the instrument zip. Default is the current WD.
- record.id:
flag to omit the first row of the data dictionary assuming this is the
record_id field which should not be included in the instrument.
Default is TRUE.
## Value
list
## Examples
``` r
if (FALSE) { # \dontrun{
data <- iris |>
ds2dd_detailed(
add.auto.id = TRUE,
form.name = sample(c("b", "c"),
size = 6,
replace = TRUE, prob = rep(.5, 2)
)
) |>
purrr::pluck("meta")
# data |> create_instrument_meta()
data <- iris |>
ds2dd_detailed(add.auto.id = FALSE) |>
purrr::pluck("data")
iris |>
setNames(glue::glue("{sample(x = c('a','b'),size = length(ncol(iris)),
replace=TRUE,prob = rep(x=.5,2))}__{names(iris)}")) |>
ds2dd_detailed(form.sep = "__")
data |>
purrr::pluck("meta") |>
create_instrument_meta(record.id = FALSE)
} # }
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Cut string to desired length — cut_string_length • 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="Cut string to desired length — cut_string_length"><meta name="description" content="Cut string to desired length"><meta property="og:description" content="Cut string to desired length"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Cut string to desired length — cut_string_length • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Cut string to desired length — cut_string_length"><meta name="description" content="Cut string to desired length"><meta property="og:description" content="Cut string to desired length"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Cut string to desired length</h1> <h1>Cut string to desired length</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/utils.r" class="external-link"><code>R/utils.r</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/utils.r" class="external-link"><code>R/utils.r</code></a></small>
<div class="d-none name"><code>cut_string_length.Rd</code></div> <div class="d-none name"><code>cut_string_length.Rd</code></div>
</div> </div>
@ -80,7 +80,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,30 @@
# Cut string to desired length
Cut string to desired length
## Usage
``` r
cut_string_length(data, l = 100)
```
## Arguments
- data:
data
- l:
length
## Value
character string of length l
## Examples
``` r
"length" |> cut_string_length(l=3)
#> [1] "len"
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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 single digits to words — d2w • 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 single digits to words — d2w"><meta name="description" content="Convert single digits to words"><meta property="og:description" content="Convert single digits to words"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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 single digits to words — d2w • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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 single digits to words — d2w"><meta name="description" content="Convert single digits to words"><meta property="og:description" content="Convert single digits to words"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Convert single digits to words</h1> <h1>Convert single digits to words</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/utils.r" class="external-link"><code>R/utils.r</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/utils.r" class="external-link"><code>R/utils.r</code></a></small>
<div class="d-none name"><code>d2w.Rd</code></div> <div class="d-none name"><code>d2w.Rd</code></div>
</div> </div>
@ -110,7 +110,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

59
reference/d2w.md Normal file
View file

@ -0,0 +1,59 @@
# Convert single digits to words
Convert single digits to words
## Usage
``` r
d2w(x, lang = "en", neutrum = FALSE, everything = FALSE)
```
## Arguments
- x:
data. Handle vectors, data.frames and lists
- lang:
language. Danish (da) and English (en), Default is "en"
- neutrum:
for numbers depending on counted word
- everything:
flag to also split numbers \>9 to single digits
## Value
returns characters in same format as input
## Examples
``` r
d2w(c(2:8, 21))
#> [1] "two" "three" "four" "five" "six" "seven" "eight" "21"
d2w(data.frame(2:7, 3:8, 1), lang = "da", neutrum = TRUE)
#> X2.7 X3.8 X1
#> 1 to tre et
#> 2 tre fire et
#> 3 fire fem et
#> 4 fem seks et
#> 5 seks syv et
#> 6 syv otte et
## If everything=T, also larger numbers are reduced.
## Elements in the list are same length as input
d2w(list(2:8, c(2, 6, 4, 23), 2), everything = TRUE)
#> [[1]]
#> [1] "two" "three" "four" "five" "six" "seven" "eight"
#>
#> [[2]]
#> [1] "two" "six" "four" "two three"
#>
#> [[3]]
#> [1] "two"
#>
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Doc table to data dictionary - EARLY, DOCS MISSING — doc2dd • 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="Doc table to data dictionary - EARLY, DOCS MISSING — doc2dd"><meta name="description" content="Works well with `project.aid::docx2list()`. <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Doc table to data dictionary - EARLY, DOCS MISSING — doc2dd • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Doc table to data dictionary - EARLY, DOCS MISSING — doc2dd"><meta name="description" content="Works well with `project.aid::docx2list()`.
Allows defining a database in a text document (see provided template) for Allows defining a database in a text document (see provided template) for
an easier to use data base creation. This approach allows easier an easier to use data base creation. This approach allows easier
collaboration when defining the database. The generic case is a data frame collaboration when defining the database. The generic case is a data frame
@ -17,7 +17,7 @@ data dictionary, but gives a few options for formatting."></head><body>
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -45,7 +45,7 @@ data dictionary, but gives a few options for formatting."></head><body>
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Doc table to data dictionary - EARLY, DOCS MISSING</h1> <h1>Doc table to data dictionary - EARLY, DOCS MISSING</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/doc2dd.R" class="external-link"><code>R/doc2dd.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/doc2dd.R" class="external-link"><code>R/doc2dd.R</code></a></small>
<div class="d-none name"><code>doc2dd.Rd</code></div> <div class="d-none name"><code>doc2dd.Rd</code></div>
</div> </div>
@ -171,7 +171,7 @@ Character vector.</p></dd>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

106
reference/doc2dd.md Normal file
View file

@ -0,0 +1,106 @@
# Doc table to data dictionary - EARLY, DOCS MISSING
Works well with \`project.aid::docx2list()\`. Allows defining a database
in a text document (see provided template) for an easier to use data
base creation. This approach allows easier collaboration when defining
the database. The generic case is a data frame with variable names as
values in a column. This is a format like the REDCap data dictionary,
but gives a few options for formatting.
## Usage
``` r
doc2dd(
data,
instrument.name,
col.variables = 1,
list.datetime.format = list(date_dmy = "_dat[eo]$", time_hh_mm_ss = "_ti[md]e?$"),
col.description = NULL,
col.condition = NULL,
col.subheader = NULL,
subheader.tag = "h2",
condition.minor.sep = ",",
condition.major.sep = ";",
col.calculation = NULL,
col.choices = NULL,
choices.char.sep = "/",
missing.default = NA
)
```
## Arguments
- data:
tibble or data.frame with all variable names in one column
- instrument.name:
character vector length one. Instrument name.
- col.variables:
variable names column (default = 1), allows dplyr subsetting
- list.datetime.format:
formatting for date/time detection. See \`case_match_regex_list()\`
- col.description:
descriptions column, allows dplyr subsetting. If empty, variable names
will be used.
- col.condition:
conditions for branching column, allows dplyr subsetting. See
\`char2cond()\`.
- col.subheader:
sub-header column, allows dplyr subsetting. See
\`format_subheader()\`.
- subheader.tag:
formatting tag. Default is "h2"
- condition.minor.sep:
condition split minor. See \`char2cond()\`. Default is ",".
- condition.major.sep:
condition split major. See \`char2cond()\`. Default is ";".
- col.calculation:
calculations column. Has to be written exact. Character vector.
- col.choices:
choices column. See \`char2choice()\`.
- choices.char.sep:
choices split. See \`char2choice()\`. Default is "/".
- missing.default:
value for missing fields. Default is NA.
## Value
tibble or data.frame (same as data)
## Examples
``` r
# data <- dd_inst
# data |> doc2dd(instrument.name = "evt",
# col.description = 3,
# col.condition = 4,
# col.subheader = 2,
# col.calculation = 5,
# col.choices = 6)
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>(DEPRECATED) Data set to data dictionary function — ds2dd • 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="(DEPRECATED) Data set to data dictionary function — ds2dd"><meta name="description" content="Creates a very basic data dictionary skeleton. Please see `ds2dd_detailed()` <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>(DEPRECATED) Data set to data dictionary function — ds2dd • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="(DEPRECATED) Data set to data dictionary function — ds2dd"><meta name="description" content="Creates a very basic data dictionary skeleton. Please see `ds2dd_detailed()`
for a more advanced function."><meta property="og:description" content="Creates a very basic data dictionary skeleton. Please see `ds2dd_detailed()` for a more advanced function."><meta property="og:description" content="Creates a very basic data dictionary skeleton. Please see `ds2dd_detailed()`
for a more advanced function."></head><body> for a more advanced function."></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -9,7 +9,7 @@ for a more advanced function."></head><body>
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -37,7 +37,7 @@ for a more advanced function."></head><body>
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>(DEPRECATED) Data set to data dictionary function</h1> <h1>(DEPRECATED) Data set to data dictionary function</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/ds2dd_detailed.R" class="external-link"><code>R/ds2dd_detailed.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>ds2dd.Rd</code></div> <div class="d-none name"><code>ds2dd.Rd</code></div>
</div> </div>
@ -309,7 +309,7 @@ names(REDCapCAST::redcapcast_meta).</p></dd>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

257
reference/ds2dd.md Normal file
View file

@ -0,0 +1,257 @@
# (DEPRECATED) Data set to data dictionary function
Creates a very basic data dictionary skeleton. Please see
\`ds2dd_detailed()\` for a more advanced function.
## Usage
``` r
ds2dd(
ds,
record.id = "record_id",
form.name = "basis",
field.type = "text",
field.label = NULL,
include.column.names = FALSE,
metadata = names(REDCapCAST::redcapcast_meta)
)
```
## Arguments
- ds:
data set
- record.id:
name or column number of id variable, moved to first row of data
dictionary, character of integer. Default is "record_id".
- form.name:
vector of form names, character string, length 1 or length equal to
number of variables. Default is "basis".
- field.type:
vector of field types, character string, length 1 or length equal to
number of variables. Default is "text.
- field.label:
vector of form names, character string, length 1 or length equal to
number of variables. Default is NULL and is then identical to field
names.
- include.column.names:
Flag to give detailed output including new column names for original
data set for upload.
- metadata:
Metadata column names. Default is the included
names(REDCapCAST::redcapcast_meta).
## Value
data.frame or list of data.frame and vector
## Details
Migrated from stRoke ds2dd(). Fits better with the functionality of
'REDCapCAST'.
## Examples
``` r
redcapcast_data$record_id <- seq_len(nrow(redcapcast_data))
ds2dd(redcapcast_data, include.column.names = TRUE)
#> $DataDictionary
#> field_name form_name section_header field_type
#> 1 record_id basis NA text
#> 2 redcap_event_name basis NA text
#> 3 redcap_repeat_instrument basis NA text
#> 4 redcap_repeat_instance basis NA text
#> 5 cpr basis NA text
#> 6 inclusion basis NA text
#> 7 inclusion_time basis NA text
#> 8 dob basis NA text
#> 9 age basis NA text
#> 10 age_integer basis NA text
#> 11 sex basis NA text
#> 12 cohabitation basis NA text
#> 13 hypertension basis NA text
#> 14 diabetes basis NA text
#> 15 region basis NA text
#> 16 baseline_data_start_complete basis NA text
#> 17 mrs_assessed basis NA text
#> 18 mrs_date basis NA text
#> 19 mrs_score basis NA text
#> 20 mrs_complete basis NA text
#> 21 con_mrs basis NA text
#> 22 con_calc basis NA text
#> 23 consensus_complete basis NA text
#> 24 event_datetime basis NA text
#> 25 event_age basis NA text
#> 26 event_type basis NA text
#> 27 new_event_complete basis NA text
#> field_label select_choices_or_calculations field_note
#> 1 record_id NA NA
#> 2 redcap_event_name NA NA
#> 3 redcap_repeat_instrument NA NA
#> 4 redcap_repeat_instance NA NA
#> 5 cpr NA NA
#> 6 inclusion NA NA
#> 7 inclusion_time NA NA
#> 8 dob NA NA
#> 9 age NA NA
#> 10 age_integer NA NA
#> 11 sex NA NA
#> 12 cohabitation NA NA
#> 13 hypertension NA NA
#> 14 diabetes NA NA
#> 15 region NA NA
#> 16 baseline_data_start_complete NA NA
#> 17 mrs_assessed NA NA
#> 18 mrs_date NA NA
#> 19 mrs_score NA NA
#> 20 mrs_complete NA NA
#> 21 con_mrs NA NA
#> 22 con_calc NA NA
#> 23 consensus_complete NA NA
#> 24 event_datetime NA NA
#> 25 event_age NA NA
#> 26 event_type NA NA
#> 27 new_event_complete NA NA
#> text_validation_type_or_show_slider_number text_validation_min
#> 1 NA NA
#> 2 NA NA
#> 3 NA NA
#> 4 NA NA
#> 5 NA NA
#> 6 NA NA
#> 7 NA NA
#> 8 NA NA
#> 9 NA NA
#> 10 NA NA
#> 11 NA NA
#> 12 NA NA
#> 13 NA NA
#> 14 NA NA
#> 15 NA NA
#> 16 NA NA
#> 17 NA NA
#> 18 NA NA
#> 19 NA NA
#> 20 NA NA
#> 21 NA NA
#> 22 NA NA
#> 23 NA NA
#> 24 NA NA
#> 25 NA NA
#> 26 NA NA
#> 27 NA NA
#> text_validation_max identifier branching_logic required_field
#> 1 NA NA NA NA
#> 2 NA NA NA NA
#> 3 NA NA NA NA
#> 4 NA NA NA NA
#> 5 NA NA NA NA
#> 6 NA NA NA NA
#> 7 NA NA NA NA
#> 8 NA NA NA NA
#> 9 NA NA NA NA
#> 10 NA NA NA NA
#> 11 NA NA NA NA
#> 12 NA NA NA NA
#> 13 NA NA NA NA
#> 14 NA NA NA NA
#> 15 NA NA NA NA
#> 16 NA NA NA NA
#> 17 NA NA NA NA
#> 18 NA NA NA NA
#> 19 NA NA NA NA
#> 20 NA NA NA NA
#> 21 NA NA NA NA
#> 22 NA NA NA NA
#> 23 NA NA NA NA
#> 24 NA NA NA NA
#> 25 NA NA NA NA
#> 26 NA NA NA NA
#> 27 NA NA NA NA
#> custom_alignment question_number matrix_group_name matrix_ranking
#> 1 NA NA NA NA
#> 2 NA NA NA NA
#> 3 NA NA NA NA
#> 4 NA NA NA NA
#> 5 NA NA NA NA
#> 6 NA NA NA NA
#> 7 NA NA NA NA
#> 8 NA NA NA NA
#> 9 NA NA NA NA
#> 10 NA NA NA NA
#> 11 NA NA NA NA
#> 12 NA NA NA NA
#> 13 NA NA NA NA
#> 14 NA NA NA NA
#> 15 NA NA NA NA
#> 16 NA NA NA NA
#> 17 NA NA NA NA
#> 18 NA NA NA NA
#> 19 NA NA NA NA
#> 20 NA NA NA NA
#> 21 NA NA NA NA
#> 22 NA NA NA NA
#> 23 NA NA NA NA
#> 24 NA NA NA NA
#> 25 NA NA NA NA
#> 26 NA NA NA NA
#> 27 NA NA NA NA
#> field_annotation
#> 1 NA
#> 2 NA
#> 3 NA
#> 4 NA
#> 5 NA
#> 6 NA
#> 7 NA
#> 8 NA
#> 9 NA
#> 10 NA
#> 11 NA
#> 12 NA
#> 13 NA
#> 14 NA
#> 15 NA
#> 16 NA
#> 17 NA
#> 18 NA
#> 19 NA
#> 20 NA
#> 21 NA
#> 22 NA
#> 23 NA
#> 24 NA
#> 25 NA
#> 26 NA
#> 27 NA
#>
#> $`Column names`
#> [1] "record_id" "redcap_event_name"
#> [3] "redcap_repeat_instrument" "redcap_repeat_instance"
#> [5] "cpr" "inclusion"
#> [7] "inclusion_time" "dob"
#> [9] "age" "age_integer"
#> [11] "sex" "cohabitation"
#> [13] "hypertension" "diabetes"
#> [15] "region" "baseline_data_start_complete"
#> [17] "mrs_assessed" "mrs_date"
#> [19] "mrs_score" "mrs_complete"
#> [21] "con_mrs" "con_calc"
#> [23] "consensus_complete" "event_datetime"
#> [25] "event_age" "event_type"
#> [27] "new_event_complete"
#>
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Extract data from stata file for data dictionary — ds2dd_detailed • 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="Extract data from stata file for data dictionary — ds2dd_detailed"><meta name="description" content="Extract data from stata file for data dictionary"><meta property="og:description" content="Extract data from stata file for data dictionary"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Extract data from stata file for data dictionary — ds2dd_detailed • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Extract data from stata file for data dictionary — ds2dd_detailed"><meta name="description" content="Extract data from stata file for data dictionary"><meta property="og:description" content="Extract data from stata file for data dictionary"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Extract data from stata file for data dictionary</h1> <h1>Extract data from stata file for data dictionary</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/ds2dd_detailed.R" class="external-link"><code>R/ds2dd_detailed.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>ds2dd_detailed.Rd</code></div> <div class="d-none name"><code>ds2dd_detailed.Rd</code></div>
</div> </div>
@ -165,8 +165,8 @@ Please, do always inspect the data dictionary before upload.</p>
<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;"># 15 more rows</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 16 more variables: cohabitation &lt;chr&gt;, hypertension &lt;chr&gt;, diabetes &lt;chr&gt;,</span></span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 16 more variables: cohabitation &lt;chr&gt;, hypertension &lt;chr&gt;, diabetes &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># region &lt;chr&gt;, baseline_data_start_complete &lt;chr&gt;, mrs_assessed &lt;chr&gt;,</span></span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># region &lt;chr&gt;, baseline_data_start_complete &lt;chr&gt;, mrs_assessed &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># mrs_date &lt;date&gt;, mrs_score &lt;dbl&gt;, mrs_complete &lt;chr&gt;, con_mrs &lt;lgl&gt;,</span></span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># mrs_date &lt;date&gt;, mrs_score &lt;dbl&gt;, mrs_complete &lt;chr&gt;, con_mrs &lt;dbl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># con_calc &lt;lgl&gt;, consensus_complete &lt;chr&gt;, event_datetime &lt;dttm&gt;,</span></span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># con_calc &lt;dbl&gt;, consensus_complete &lt;chr&gt;, event_datetime &lt;dttm&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># event_age &lt;dbl&gt;, event_type &lt;chr&gt;, new_event_complete &lt;chr&gt;</span></span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># event_age &lt;dbl&gt;, event_type &lt;chr&gt;, new_event_complete &lt;chr&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> </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> $meta</span>
@ -242,12 +242,12 @@ Please, do always inspect the data dictionary before upload.</p>
<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> <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> 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: #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;">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> sepallength 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;">2</span> sepallength 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> sepalwidth c <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;">3</span> sepalwidth c <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> petallength c <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;">4</span> petallength 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> petalwidth 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;">5</span> petalwidth 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: #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;"># 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_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;"># text_validation_min &lt;lgl&gt;, text_validation_max &lt;lgl&gt;, identifier &lt;lgl&gt;,</span></span>
@ -273,7 +273,7 @@ Please, do always inspect the data dictionary before upload.</p>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 9 22.8 1 141. 95 3.92 3.15 22.9 2 1 2 2</span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 9 22.8 1 141. 95 3.92 3.15 22.9 2 1 2 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 10 19.2 2 168. 123 3.92 3.44 18.3 2 1 2 4</span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 10 19.2 2 168. 123 3.92 3.44 18.3 2 1 2 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 style="color: #949494;"># 22 more rows</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 1 more variable: unknown &lt;lgl&gt;</span></span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 1 more variable: unknown &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> </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> $meta</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 13 × 18</span></span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 13 × 18</span></span>
@ -329,10 +329,10 @@ Please, do always inspect the data dictionary before upload.</p>
<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> <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> 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: #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 a <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;">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> sepallength a <span style="color: #BB0000;">NA</span> text sepallength</span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> sepallength a <span style="color: #BB0000;">NA</span> text sepallength</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> sepalwidth b <span style="color: #BB0000;">NA</span> text sepalwidth </span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> sepalwidth a <span style="color: #BB0000;">NA</span> text sepalwidth </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">4</span> petallength b <span style="color: #BB0000;">NA</span> text petallength</span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">4</span> petallength a <span style="color: #BB0000;">NA</span> text petallength</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">5</span> petalwidth a <span style="color: #BB0000;">NA</span> text petalwidth </span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">5</span> petalwidth a <span style="color: #BB0000;">NA</span> text petalwidth </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">6</span> species a <span style="color: #BB0000;">NA</span> text species </span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">6</span> species a <span style="color: #BB0000;">NA</span> text 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;lgl&gt;, field_note &lt;lgl&gt;,</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;lgl&gt;, field_note &lt;lgl&gt;,</span></span>
@ -355,7 +355,7 @@ Please, do always inspect the data dictionary before upload.</p>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

307
reference/ds2dd_detailed.md Normal file
View file

@ -0,0 +1,307 @@
# Extract data from stata file for data dictionary
Extract data from stata file for data dictionary
## Usage
``` r
ds2dd_detailed(
data,
add.auto.id = FALSE,
date.format = "dmy",
form.name = NULL,
form.sep = NULL,
form.prefix = TRUE,
field.type = NULL,
field.label = NULL,
field.label.attr = "label",
field.validation = NULL,
metadata = names(REDCapCAST::redcapcast_meta),
convert.logicals = FALSE
)
```
## Arguments
- data:
data frame
- add.auto.id:
flag to add id column
- date.format:
date format, character string. ymd/dmy/mdy. dafault is dmy.
- form.name:
manually specify form name(s). Vector of length 1 or ncol(data).
Default is NULL and "data" is used.
- form.sep:
If supplied dataset has form names as suffix or prefix to the
column/variable names, the seperator can be specified. If supplied,
the form.name is ignored. Default is NULL.
- form.prefix:
Flag to set if form is prefix (TRUE) or suffix (FALSE) to the column
names. Assumes all columns have pre- or suffix if specified.
- field.type:
manually specify field type(s). Vector of length 1 or ncol(data).
Default is NULL and "text" is used for everything but factors, which
wil get "radio".
- field.label:
manually specify field label(s). Vector of length 1 or ncol(data).
Default is NULL and colnames(data) is used or attribute
\`field.label.attr\` for haven_labelled data set (imported .dta file
with \`haven::read_dta()\`).
- field.label.attr:
attribute name for named labels for haven_labelled data set (imported
.dta file with \`haven::read_dta()\`. Default is "label"
- field.validation:
manually specify field validation(s). Vector of length 1 or
ncol(data). Default is NULL and \`levels()\` are used for factors or
attribute \`factor.labels.attr\` for haven_labelled data set (imported
.dta file with \`haven::read_dta()\`).
- metadata:
redcap metadata headings. Default is
names(REDCapCAST::redcapcast_meta).
- convert.logicals:
convert logicals to factor. Default is TRUE.
## Value
list of length 2
## Details
This function is a natural development of the ds2dd() function. It
assumes that the first column is the ID-column. No checks. Please, do
always inspect the data dictionary before upload.
Ensure, that the data set is formatted with as much information as
possible.
\`field.type\` can be supplied
## Examples
``` r
## Basic parsing with default options
requireNamespace("REDCapCAST")
redcapcast_data |>
dplyr::select(-dplyr::starts_with("redcap_")) |>
ds2dd_detailed()
#> $data
#> # A tibble: 25 × 24
#> record_id cpr inclusion inclusion_time dob age age_integer sex
#> <dbl> <chr> <date> <chr> <date> <dbl> <dbl> <chr>
#> 1 1 12034… 2023-03-13 12:38:49 1940-03-12 83.0 83 fema…
#> 2 2 01023… 2023-03-01 10:38:57 1934-02-01 89.1 89 male
#> 3 2 NA NA NA NA NA NA NA
#> 4 2 NA NA NA NA NA NA NA
#> 5 3 23015… 2022-03-08 12:01:07 1956-01-23 66.1 66 male
#> 6 3 NA NA NA NA NA NA NA
#> 7 3 NA NA NA NA NA NA NA
#> 8 3 NA NA NA NA NA NA NA
#> 9 3 NA NA NA NA NA NA NA
#> 10 3 NA NA NA NA NA NA NA
#> # 15 more rows
#> # 16 more variables: cohabitation <chr>, hypertension <chr>, diabetes <chr>,
#> # region <chr>, baseline_data_start_complete <chr>, mrs_assessed <chr>,
#> # mrs_date <date>, mrs_score <dbl>, mrs_complete <chr>, con_mrs <dbl>,
#> # con_calc <dbl>, consensus_complete <chr>, event_datetime <dttm>,
#> # event_age <dbl>, event_type <chr>, new_event_complete <chr>
#>
#> $meta
#> # A tibble: 24 × 18
#> field_name form_name section_header field_type field_label
#> <chr> <chr> <lgl> <chr> <chr>
#> 1 record_id data NA text record_id
#> 2 cpr data NA text cpr
#> 3 inclusion data NA text inclusion
#> 4 inclusion_time data NA text inclusion_time
#> 5 dob data NA text dob
#> 6 age data NA text age
#> 7 age_integer data NA text age_integer
#> 8 sex data NA text sex
#> 9 cohabitation data NA text cohabitation
#> 10 hypertension data NA text hypertension
#> # 14 more rows
#> # 13 more variables: select_choices_or_calculations <lgl>, field_note <lgl>,
#> # text_validation_type_or_show_slider_number <chr>,
#> # text_validation_min <lgl>, text_validation_max <lgl>, identifier <lgl>,
#> # branching_logic <lgl>, required_field <lgl>, custom_alignment <lgl>,
#> # question_number <lgl>, matrix_group_name <lgl>, matrix_ranking <lgl>,
#> # field_annotation <lgl>
#>
#> attr(,"class")
#> [1] "REDCapCAST" "list"
## Adding a record_id field
iris |> ds2dd_detailed(add.auto.id = TRUE)
#> $data
#> # A tibble: 150 × 6
#> record_id sepallength sepalwidth petallength petalwidth species
#> <int> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 5.1 3.5 1.4 0.2 1
#> 2 2 4.9 3 1.4 0.2 1
#> 3 3 4.7 3.2 1.3 0.2 1
#> 4 4 4.6 3.1 1.5 0.2 1
#> 5 5 5 3.6 1.4 0.2 1
#> 6 6 5.4 3.9 1.7 0.4 1
#> 7 7 4.6 3.4 1.4 0.3 1
#> 8 8 5 3.4 1.5 0.2 1
#> 9 9 4.4 2.9 1.4 0.2 1
#> 10 10 4.9 3.1 1.5 0.1 1
#> # 140 more rows
#>
#> $meta
#> # A tibble: 6 × 18
#> field_name form_name section_header field_type field_label
#> <chr> <chr> <lgl> <chr> <chr>
#> 1 record_id data NA text record_id
#> 2 sepallength data NA text Sepal.Length
#> 3 sepalwidth data NA text Sepal.Width
#> 4 petallength data NA text Petal.Length
#> 5 petalwidth data NA text Petal.Width
#> 6 species data NA radio Species
#> # 13 more variables: select_choices_or_calculations <chr>, field_note <lgl>,
#> # text_validation_type_or_show_slider_number <chr>,
#> # text_validation_min <lgl>, text_validation_max <lgl>, identifier <lgl>,
#> # branching_logic <lgl>, required_field <lgl>, custom_alignment <lgl>,
#> # question_number <lgl>, matrix_group_name <lgl>, matrix_ranking <lgl>,
#> # field_annotation <lgl>
#>
#> attr(,"class")
#> [1] "REDCapCAST" "list"
## Passing form name information to function
iris |>
ds2dd_detailed(
add.auto.id = TRUE,
form.name = sample(c("b", "c"), size = 6, replace = TRUE, prob = rep(.5, 2))
) |>
purrr::pluck("meta")
#> # A tibble: 6 × 18
#> field_name form_name section_header field_type field_label
#> <chr> <chr> <lgl> <chr> <chr>
#> 1 record_id c NA text record_id
#> 2 sepallength b NA text Sepal.Length
#> 3 sepalwidth c NA text Sepal.Width
#> 4 petallength b NA text Petal.Length
#> 5 petalwidth c NA text Petal.Width
#> 6 species b NA radio Species
#> # 13 more variables: select_choices_or_calculations <chr>, field_note <lgl>,
#> # text_validation_type_or_show_slider_number <chr>,
#> # text_validation_min <lgl>, text_validation_max <lgl>, identifier <lgl>,
#> # branching_logic <lgl>, required_field <lgl>, custom_alignment <lgl>,
#> # question_number <lgl>, matrix_group_name <lgl>, matrix_ranking <lgl>,
#> # field_annotation <lgl>
mtcars |>
dplyr::mutate(unknown = NA) |>
numchar2fct() |>
ds2dd_detailed(add.auto.id = TRUE)
#> $data
#> # A tibble: 32 × 13
#> record_id mpg cyl disp hp drat wt qsec vs am gear carb
#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 21 2 160 110 3.9 2.62 16.5 1 2 2 4
#> 2 2 21 2 160 110 3.9 2.88 17.0 1 2 2 4
#> 3 3 22.8 1 108 93 3.85 2.32 18.6 2 2 2 1
#> 4 4 21.4 2 258 110 3.08 3.22 19.4 2 1 1 1
#> 5 5 18.7 3 360 175 3.15 3.44 17.0 1 1 1 2
#> 6 6 18.1 2 225 105 2.76 3.46 20.2 2 1 1 1
#> 7 7 14.3 3 360 245 3.21 3.57 15.8 1 1 1 4
#> 8 8 24.4 1 147. 62 3.69 3.19 20 2 1 2 2
#> 9 9 22.8 1 141. 95 3.92 3.15 22.9 2 1 2 2
#> 10 10 19.2 2 168. 123 3.92 3.44 18.3 2 1 2 4
#> # 22 more rows
#> # 1 more variable: unknown <dbl>
#>
#> $meta
#> # A tibble: 13 × 18
#> field_name form_name section_header field_type field_label
#> <chr> <chr> <lgl> <chr> <chr>
#> 1 record_id data NA text record_id
#> 2 mpg data NA text mpg
#> 3 cyl data NA radio cyl
#> 4 disp data NA text disp
#> 5 hp data NA text hp
#> 6 drat data NA text drat
#> 7 wt data NA text wt
#> 8 qsec data NA text qsec
#> 9 vs data NA radio vs
#> 10 am data NA radio am
#> 11 gear data NA radio gear
#> 12 carb data NA radio carb
#> 13 unknown data NA truefalse unknown
#> # 13 more variables: select_choices_or_calculations <chr>, field_note <lgl>,
#> # text_validation_type_or_show_slider_number <chr>,
#> # text_validation_min <lgl>, text_validation_max <lgl>, identifier <lgl>,
#> # branching_logic <lgl>, required_field <lgl>, custom_alignment <lgl>,
#> # question_number <lgl>, matrix_group_name <lgl>, matrix_ranking <lgl>,
#> # field_annotation <lgl>
#>
#> attr(,"class")
#> [1] "REDCapCAST" "list"
## Using column name suffix to carry form name
data <- iris |>
ds2dd_detailed(add.auto.id = TRUE) |>
purrr::pluck("data")
names(data) <- glue::glue("{sample(x = c('a','b'),size = length(names(data)),
replace=TRUE,prob = rep(x=.5,2))}__{names(data)}")
data |> ds2dd_detailed(form.sep = "__")
#> $data
#> # A tibble: 150 × 6
#> record_id sepallength sepalwidth petallength petalwidth species
#> <int> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 5.1 3.5 1.4 0.2 1
#> 2 2 4.9 3 1.4 0.2 1
#> 3 3 4.7 3.2 1.3 0.2 1
#> 4 4 4.6 3.1 1.5 0.2 1
#> 5 5 5 3.6 1.4 0.2 1
#> 6 6 5.4 3.9 1.7 0.4 1
#> 7 7 4.6 3.4 1.4 0.3 1
#> 8 8 5 3.4 1.5 0.2 1
#> 9 9 4.4 2.9 1.4 0.2 1
#> 10 10 4.9 3.1 1.5 0.1 1
#> # 140 more rows
#>
#> $meta
#> # A tibble: 6 × 18
#> field_name form_name section_header field_type field_label
#> <chr> <chr> <lgl> <chr> <chr>
#> 1 record_id b NA text record_id
#> 2 sepallength a NA text sepallength
#> 3 sepalwidth a NA text sepalwidth
#> 4 petallength a NA text petallength
#> 5 petalwidth a NA text petalwidth
#> 6 species a NA text species
#> # 13 more variables: select_choices_or_calculations <lgl>, field_note <lgl>,
#> # text_validation_type_or_show_slider_number <chr>,
#> # text_validation_min <lgl>, text_validation_max <lgl>, identifier <lgl>,
#> # branching_logic <lgl>, required_field <lgl>, custom_alignment <lgl>,
#> # question_number <lgl>, matrix_group_name <lgl>, matrix_ranking <lgl>,
#> # field_annotation <lgl>
#>
#> attr(,"class")
#> [1] "REDCapCAST" "list"
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Secure API key storage and data acquisition in one — easy_redcap • 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="Secure API key storage and data acquisition in one — easy_redcap"><meta name="description" content="Secure API key storage and data acquisition in one"><meta property="og:description" content="Secure API key storage and data acquisition in one"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Secure API key storage and data acquisition in one — easy_redcap • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Secure API key storage and data acquisition in one — easy_redcap"><meta name="description" content="Secure API key storage and data acquisition in one"><meta property="og:description" content="Secure API key storage and data acquisition in one"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Secure API key storage and data acquisition in one</h1> <h1>Secure API key storage and data acquisition in one</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/easy_redcap.R" class="external-link"><code>R/easy_redcap.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/easy_redcap.R" class="external-link"><code>R/easy_redcap.R</code></a></small>
<div class="d-none name"><code>easy_redcap.Rd</code></div> <div class="d-none name"><code>easy_redcap.Rd</code></div>
</div> </div>
@ -108,7 +108,7 @@ data.</p></dd>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

60
reference/easy_redcap.md Normal file
View file

@ -0,0 +1,60 @@
# Secure API key storage and data acquisition in one
Secure API key storage and data acquisition in one
## Usage
``` r
easy_redcap(
project.name,
uri,
raw_or_label = "both",
data_format = c("wide", "list", "redcap", "long"),
widen.data = NULL,
...
)
```
## Arguments
- project.name:
The name of the current project (for key storage with
[key_set](https://keyring.r-lib.org/reference/key_get.html), using the
default keyring)
- uri:
REDCap database API uri
- raw_or_label:
argument passed on to
[read_redcap_tables](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_tables.md).
Default is "both" to get labelled data.
- data_format:
Choose the data
- widen.data:
argument to widen the exported data. \[DEPRECATED\], use
\`data_format\`instead
- ...:
arguments passed on to
[read_redcap_tables](https://agdamsbo.github.io/REDCapCAST/reference/read_redcap_tables.md).
## Value
data.frame or list depending on widen.data
## Examples
``` r
if (FALSE) { # \dontrun{
easy_redcap("My_new_project", fields = c("record_id", "age", "hypertension"))
} # }
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Creates zip-file with necessary content to manually add instrument to database — export_redcap_instrument • 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="Creates zip-file with necessary content to manually add instrument to database — export_redcap_instrument"><meta name="description" content="Metadata can be added by editing the data dictionary of a project in the <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Creates zip-file with necessary content to manually add instrument to database — export_redcap_instrument • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Creates zip-file with necessary content to manually add instrument to database — export_redcap_instrument"><meta name="description" content="Metadata can be added by editing the data dictionary of a project in the
initial design phase. If you want to later add new instruments, this initial design phase. If you want to later add new instruments, this
function can be used to create (an) instrument(s) to add to a project in function can be used to create (an) instrument(s) to add to a project in
production."><meta property="og:description" content="Metadata can be added by editing the data dictionary of a project in the production."><meta property="og:description" content="Metadata can be added by editing the data dictionary of a project in the
@ -13,7 +13,7 @@ production."></head><body>
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -41,7 +41,7 @@ production."></head><body>
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Creates zip-file with necessary content to manually add instrument to database</h1> <h1>Creates zip-file with necessary content to manually add instrument to database</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/export_redcap_instrument.R" class="external-link"><code>R/export_redcap_instrument.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/export_redcap_instrument.R" class="external-link"><code>R/export_redcap_instrument.R</code></a></small>
<div class="d-none name"><code>export_redcap_instrument.Rd</code></div> <div class="d-none name"><code>export_redcap_instrument.Rd</code></div>
</div> </div>
@ -116,7 +116,7 @@ just using the first.</p></dd>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,60 @@
# Creates zip-file with necessary content to manually add instrument to database
Metadata can be added by editing the data dictionary of a project in the
initial design phase. If you want to later add new instruments, this
function can be used to create (an) instrument(s) to add to a project in
production.
## Usage
``` r
export_redcap_instrument(data, file, force = FALSE, record.id = "record_id")
```
## Arguments
- data:
metadata for the relevant instrument. Could be from
\`ds2dd_detailed()\`
- file:
destination file name.
- force:
force instrument creation and ignore different form names by just
using the first.
- record.id:
record id variable name. Default is 'record_id'.
## Value
exports zip-file
## Examples
``` r
# iris |>
# ds2dd_detailed(
# add.auto.id = TRUE,
# form.name = sample(c("b", "c"), size = 6, replace = TRUE, prob = rep(.5, 2))
# ) |>
# purrr::pluck("meta") |>
# (\(.x){
# split(.x, .x$form_name)
# })() |>
# purrr::imap(function(.x, .i){
# export_redcap_instrument(.x,file=here::here(paste0(.i,Sys.Date(),".zip")))
# })
# iris |>
# ds2dd_detailed(
# add.auto.id = TRUE
# ) |>
# purrr::pluck("meta") |>
# export_redcap_instrument(file=here::here(paste0("instrument",Sys.Date(),".zip")))
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Allows conversion of factor to numeric values preserving original levels</h1> <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/v25.3.2/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/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 class="d-none name"><code>fct2num.Rd</code></div>
</div> </div>
@ -101,7 +101,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

51
reference/fct2num.md Normal file
View file

@ -0,0 +1,51 @@
# Allows conversion of factor to numeric values preserving original levels
Allows conversion of factor to numeric values preserving original levels
## Usage
``` r
fct2num(data)
```
## Arguments
- data:
vector
## Value
numeric vector
## Examples
``` r
c(1, 4, 3, "A", 7, 8, 1) |>
as_factor() |>
fct2num()
#> [1] 1 2 3 4 5 6 1
structure(c(1, 2, 3, 2, 10, 9),
labels = c(Unknown = 9, Refused = 10),
class = "haven_labelled"
) |>
as_factor() |>
fct2num()
#> [1] 1 2 3 2 10 9
structure(c(1, 2, 3, 2, 10, 9),
labels = c(Unknown = 9, Refused = 10),
class = "labelled"
) |>
as_factor() |>
fct2num()
#> [1] 1 2 3 2 10 9
structure(c(1, 2, 3, 2, 10, 9),
labels = c(Unknown = 9, Refused = 10)
) |>
as_factor() |>
fct2num()
#> [1] 1 2 3 2 NA NA
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Drop unused levels preserving label data — fct_drop • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Drop unused levels preserving label data — fct_drop"><meta name="description" content="This extends [forcats::fct_drop()] to natively work across a data.frame and <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Drop unused levels preserving label data — fct_drop • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Drop unused levels preserving label data — fct_drop"><meta name="description" content="This extends [forcats::fct_drop()] to natively work across a data.frame and
replaces [base::droplevels()]."><meta property="og:description" content="This extends [forcats::fct_drop()] to natively work across a data.frame and replaces [base::droplevels()]."><meta property="og:description" content="This extends [forcats::fct_drop()] to natively work across a data.frame and
replaces [base::droplevels()]."></head><body> replaces [base::droplevels()]."></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -9,7 +9,7 @@ replaces [base::droplevels()]."></head><body>
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -37,7 +37,7 @@ replaces [base::droplevels()]."></head><body>
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Drop unused levels preserving label data</h1> <h1>Drop unused levels preserving label data</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/fct_drop.R" class="external-link"><code>R/fct_drop.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/fct_drop.R" class="external-link"><code>R/fct_drop.R</code></a></small>
<div class="d-none name"><code>fct_drop.Rd</code></div> <div class="d-none name"><code>fct_drop.Rd</code></div>
</div> </div>
@ -136,7 +136,7 @@ replaces [base::droplevels()].</p>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

84
reference/fct_drop.md Normal file
View file

@ -0,0 +1,84 @@
# Drop unused levels preserving label data
This extends \[forcats::fct_drop()\] to natively work across a
data.frame and replaces \[base::droplevels()\].
## Usage
``` r
fct_drop(x, ...)
# S3 method for class 'data.frame'
fct_drop(x, ...)
# S3 method for class 'factor'
fct_drop(x, ...)
```
## Arguments
- x:
Factor to drop unused levels
- ...:
Other arguments passed down to method.
## Examples
``` r
mtcars |>
numchar2fct() |>
fct_drop()
#> # A tibble: 32 × 11
#> mpg cyl disp hp drat wt qsec vs am gear carb
#> <dbl> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <fct> <fct> <fct> <fct>
#> 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4
#> 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4
#> 3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1
#> 4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1
#> 5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2
#> 6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1
#> 7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4
#> 8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2
#> 9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2
#> 10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4
#> # 22 more rows
mtcars |>
numchar2fct() |>
dplyr::mutate(vs = fct_drop(vs))
#> mpg cyl disp hp drat wt qsec vs am gear carb
#> Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4
#> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4
#> Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1
#> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1
#> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2
#> Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1
#> Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4
#> Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2
#> Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2
#> Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4
#> Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4
#> Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3
#> Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3
#> Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3
#> Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4
#> Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4
#> Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4
#> Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1
#> Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2
#> Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1
#> Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1
#> Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2
#> AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2
#> Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4
#> Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2
#> Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1
#> Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2
#> Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2
#> Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4
#> Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6
#> Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8
#> Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>DEPRECATED Helper to import files correctly — file_extension • 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="DEPRECATED Helper to import files correctly — file_extension"><meta name="description" content="DEPRECATED Helper to import files correctly"><meta property="og:description" content="DEPRECATED Helper to import files correctly"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>DEPRECATED Helper to import files correctly — file_extension • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="DEPRECATED Helper to import files correctly — file_extension"><meta name="description" content="DEPRECATED Helper to import files correctly"><meta property="og:description" content="DEPRECATED Helper to import files correctly"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>DEPRECATED Helper to import files correctly</h1> <h1>DEPRECATED Helper to import files correctly</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/shiny_cast.R" class="external-link"><code>R/shiny_cast.R</code></a></small> <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>file_extension.Rd</code></div> <div class="d-none name"><code>file_extension.Rd</code></div>
</div> </div>
@ -63,7 +63,7 @@
<div class="section level2"> <div class="section level2">
<h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2> <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">file_extension</span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/list.files.html" class="external-link">list.files</a></span><span class="op">(</span><span class="fu">here</span><span class="fu">::</span><span class="fu"><a href="https://here.r-lib.org//reference/here.html" class="external-link">here</a></span><span class="op">(</span><span class="st">""</span><span class="op">)</span><span class="op">)</span><span class="op">[[</span><span class="fl">2</span><span class="op">]</span><span class="op">]</span><span class="op">)</span><span class="op">[[</span><span class="fl">1</span><span class="op">]</span><span class="op">]</span></span></span> <div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="fu">file_extension</span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/list.files.html" class="external-link">list.files</a></span><span class="op">(</span><span class="fu">here</span><span class="fu">::</span><span class="fu"><a href="https://here.r-lib.org/reference/here.html" class="external-link">here</a></span><span class="op">(</span><span class="st">""</span><span class="op">)</span><span class="op">)</span><span class="op">[[</span><span class="fl">2</span><span class="op">]</span><span class="op">]</span><span class="op">)</span><span class="op">[[</span><span class="fl">1</span><span class="op">]</span><span class="op">]</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] ""</span> <span class="r-out co"><span class="r-pr">#&gt;</span> [1] ""</span>
<span class="r-in"><span><span class="fu">file_extension</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">"file.cd..ks"</span>, <span class="st">"file"</span><span class="op">)</span><span class="op">)</span></span></span> <span class="r-in"><span><span class="fu">file_extension</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">"file.cd..ks"</span>, <span class="st">"file"</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] "ks" "" </span> <span class="r-out co"><span class="r-pr">#&gt;</span> [1] "ks" "" </span>
@ -78,7 +78,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,28 @@
# DEPRECATED Helper to import files correctly
DEPRECATED Helper to import files correctly
## Usage
``` r
file_extension(filenames)
```
## Arguments
- filenames:
file names
## Value
character vector
## Examples
``` r
file_extension(list.files(here::here(""))[[2]])[[1]]
#> [1] ""
file_extension(c("file.cd..ks", "file"))
#> [1] "ks" ""
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>focused_metadata — focused_metadata • 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="focused_metadata — focused_metadata"><meta name="description" content="Extracts limited metadata for variables in a dataset"><meta property="og:description" content="Extracts limited metadata for variables in a dataset"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>focused_metadata — focused_metadata • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="focused_metadata — focused_metadata"><meta name="description" content="Extracts limited metadata for variables in a dataset"><meta property="og:description" content="Extracts limited metadata for variables in a dataset"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>focused_metadata</h1> <h1>focused_metadata</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/utils.r" class="external-link"><code>R/utils.r</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/utils.r" class="external-link"><code>R/utils.r</code></a></small>
<div class="d-none name"><code>focused_metadata.Rd</code></div> <div class="d-none name"><code>focused_metadata.Rd</code></div>
</div> </div>
@ -74,7 +74,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,23 @@
# focused_metadata
Extracts limited metadata for variables in a dataset
## Usage
``` r
focused_metadata(metadata, vars_in_data)
```
## Arguments
- metadata:
A dataframe containing metadata
- vars_in_data:
Vector of variable names in the dataset
## Value
A dataframe containing metadata for the variables in the dataset

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Converts REDCap choices to factor levels and stores in labels attribute — format_redcap_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="Converts REDCap choices to factor levels and stores in labels attribute — format_redcap_factor"><meta name="description" content="Applying as_factor to the data.frame or variable, will <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Converts REDCap choices to factor levels and stores in labels attribute — format_redcap_factor • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Converts REDCap choices to factor levels and stores in labels attribute — format_redcap_factor"><meta name="description" content="Applying as_factor to the data.frame or variable, will
coerce to a factor."><meta property="og:description" content="Applying as_factor to the data.frame or variable, will coerce to a factor."><meta property="og:description" content="Applying as_factor to the data.frame or variable, will
coerce to a factor."></head><body> coerce to a factor."></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -9,7 +9,7 @@ coerce to a factor."></head><body>
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -37,7 +37,7 @@ coerce to a factor."></head><body>
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Converts REDCap choices to factor levels and stores in labels attribute</h1> <h1>Converts REDCap choices to factor levels and stores in labels attribute</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/read_redcap_tables.R" class="external-link"><code>R/read_redcap_tables.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/read_redcap_tables.R" class="external-link"><code>R/read_redcap_tables.R</code></a></small>
<div class="d-none name"><code>format_redcap_factor.Rd</code></div> <div class="d-none name"><code>format_redcap_factor.Rd</code></div>
</div> </div>
@ -71,7 +71,7 @@ coerce to a factor.</p>
<div class="section level2"> <div class="section level2">
<h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2> <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">format_redcap_factor</span><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="fl">1</span><span class="op">:</span><span class="fl">3</span>, <span class="fl">20</span>, <span class="cn">TRUE</span><span class="op">)</span>, <span class="st">"1, First. | 2, second | 3, THIRD"</span><span class="op">)</span></span></span> <div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="fu">format_redcap_factor</span><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="fl">1</span><span class="op">:</span><span class="fl">3</span>, <span class="fl">20</span>, <span class="cn">TRUE</span><span class="op">)</span>, <span class="st">"1, First. | 2, second | 3, THIRD"</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 2 2 1 2 1 2 3 1 2 2 2 1 1 3 2 1 2 3 1 1</span> <span class="r-out co"><span class="r-pr">#&gt;</span> [1] 3 3 3 3 2 3 3 3 2 3 2 2 1 1 2 2 1 1 3 1</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> attr(,"labels")</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> First. second THIRD </span> <span class="r-out co"><span class="r-pr">#&gt;</span> First. second THIRD </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> "1" "2" "3" </span> <span class="r-out co"><span class="r-pr">#&gt;</span> "1" "2" "3" </span>
@ -88,7 +88,7 @@ coerce to a factor.</p>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,37 @@
# Converts REDCap choices to factor levels and stores in labels attribute
Applying
[as_factor](https://agdamsbo.github.io/REDCapCAST/reference/as_factor.md)
to the data.frame or variable, will coerce to a factor.
## Usage
``` r
format_redcap_factor(data, meta)
```
## Arguments
- data:
vector
- meta:
vector of REDCap choices
## Value
vector of class "labelled" with a "labels" attribute
## Examples
``` r
format_redcap_factor(sample(1:3, 20, TRUE), "1, First. | 2, second | 3, THIRD")
#> [1] 3 3 3 3 2 3 3 3 2 3 2 2 1 1 2 2 1 1 3 1
#> attr(,"labels")
#> First. second THIRD
#> "1" "2" "3"
#> attr(,"class")
#> [1] "labelled"
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Sub-header formatting wrapper — format_subheader • 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="Sub-header formatting wrapper — format_subheader"><meta name="description" content="Sub-header formatting wrapper"><meta property="og:description" content="Sub-header formatting wrapper"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Sub-header formatting wrapper — format_subheader • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Sub-header formatting wrapper — format_subheader"><meta name="description" content="Sub-header formatting wrapper"><meta property="og:description" content="Sub-header formatting wrapper"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Sub-header formatting wrapper</h1> <h1>Sub-header formatting wrapper</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/html_styling.R" class="external-link"><code>R/html_styling.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/html_styling.R" class="external-link"><code>R/html_styling.R</code></a></small>
<div class="d-none name"><code>format_subheader.Rd</code></div> <div class="d-none name"><code>format_subheader.Rd</code></div>
</div> </div>
@ -80,7 +80,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,30 @@
# Sub-header formatting wrapper
Sub-header formatting wrapper
## Usage
``` r
format_subheader(data, tag = "h2")
```
## Arguments
- data:
character vector
- tag:
character vector length 1
## Value
character vector
## Examples
``` r
"Instrument header" |> format_subheader()
#> <div class="rich-text-field-label"><h2>Instrument header</h2></div>
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Retrieve project API key if stored, if not, set and retrieve — get_api_key • 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="Retrieve project API key if stored, if not, set and retrieve — get_api_key"><meta name="description" content="Attempting to make secure API key storage so simple, that no other way makes <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Retrieve project API key if stored, if not, set and retrieve — get_api_key • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Retrieve project API key if stored, if not, set and retrieve — get_api_key"><meta name="description" content="Attempting to make secure API key storage so simple, that no other way makes
sense. Wrapping key_get and key_set using the sense. Wrapping key_get and key_set using the
key_list to check if key is in storage already."><meta property="og:description" content="Attempting to make secure API key storage so simple, that no other way makes key_list to check if key is in storage already."><meta property="og:description" content="Attempting to make secure API key storage so simple, that no other way makes
sense. Wrapping key_get and key_set using the sense. Wrapping key_get and key_set using the
@ -11,7 +11,7 @@ key_list to check if key is in storage already."></head><body>
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -39,7 +39,7 @@ key_list to check if key is in storage already."></head><body>
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Retrieve project API key if stored, if not, set and retrieve</h1> <h1>Retrieve project API key if stored, if not, set and retrieve</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/easy_redcap.R" class="external-link"><code>R/easy_redcap.R</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/easy_redcap.R" class="external-link"><code>R/easy_redcap.R</code></a></small>
<div class="d-none name"><code>get_api_key.Rd</code></div> <div class="d-none name"><code>get_api_key.Rd</code></div>
</div> </div>
@ -80,7 +80,7 @@ sense. Wrapping <a href="https://keyring.r-lib.org/reference/key_get.html" class
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

28
reference/get_api_key.md Normal file
View file

@ -0,0 +1,28 @@
# Retrieve project API key if stored, if not, set and retrieve
Attempting to make secure API key storage so simple, that no other way
makes sense. Wrapping
[key_get](https://keyring.r-lib.org/reference/key_get.html) and
[key_set](https://keyring.r-lib.org/reference/key_get.html) using the
[key_list](https://keyring.r-lib.org/reference/key_get.html) to check if
key is in storage already.
## Usage
``` r
get_api_key(key.name, ...)
```
## Arguments
- key.name:
character vector of key name
- ...:
passed to [key_set](https://keyring.r-lib.org/reference/key_get.html)
## Value
character vector

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Extract attribute. Returns NA if none — get_attr • 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="Extract attribute. Returns NA if none — get_attr"><meta name="description" content="Extract attribute. Returns NA if none"><meta property="og:description" content="Extract attribute. Returns NA if none"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Extract attribute. Returns NA if none — get_attr • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Extract attribute. Returns NA if none — get_attr"><meta name="description" content="Extract attribute. Returns NA if none"><meta property="og:description" content="Extract attribute. Returns NA if none"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Extract attribute. Returns NA if none</h1> <h1>Extract attribute. Returns NA if none</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/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/as_factor.R" class="external-link"><code>R/as_factor.R</code></a></small>
<div class="d-none name"><code>get_attr.Rd</code></div> <div class="d-none name"><code>get_attr.Rd</code></div>
</div> </div>
@ -88,7 +88,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

38
reference/get_attr.md Normal file
View file

@ -0,0 +1,38 @@
# Extract attribute. Returns NA if none
Extract attribute. Returns NA if none
## Usage
``` r
get_attr(data, attr = NULL)
```
## Arguments
- data:
vector
- attr:
attribute name
## Value
character vector
## Examples
``` r
attr(mtcars$mpg, "label") <- "testing"
do.call(c, sapply(mtcars, get_attr))
#> $mpg.label
#> [1] "testing"
#>
if (FALSE) { # \dontrun{
mtcars |>
numchar2fct(numeric.threshold = 6) |>
ds2dd_detailed()
} # }
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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 the id name — get_id_name • 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 the id name — get_id_name"><meta name="description" content="Get the id name"><meta property="og:description" content="Get the id name"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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 the id name — get_id_name • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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 the id name — get_id_name"><meta name="description" content="Get the id name"><meta property="og:description" content="Get the id name"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Get the id name</h1> <h1>Get the id name</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/utils.r" class="external-link"><code>R/utils.r</code></a></small> <small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/utils.r" class="external-link"><code>R/utils.r</code></a></small>
<div class="d-none name"><code>get_id_name.Rd</code></div> <div class="d-none name"><code>get_id_name.Rd</code></div>
</div> </div>
@ -70,7 +70,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

19
reference/get_id_name.md Normal file
View file

@ -0,0 +1,19 @@
# Get the id name
Get the id name
## Usage
``` r
get_id_name(data)
```
## Arguments
- data:
data frame or list
## Value
character vector

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Guess time variables based on naming pattern — guess_time_only • 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="Guess time variables based on naming pattern — guess_time_only"><meta name="description" content='This is for repairing data with time variables with appended "1970-01-01"'><meta property="og:description" content='This is for repairing data with time variables with appended "1970-01-01"'></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Guess time variables based on naming pattern — guess_time_only • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Guess time variables based on naming pattern — guess_time_only"><meta name="description" content='This is for repairing data with time variables with appended "1970-01-01"'><meta property="og:description" content='This is for repairing data with time variables with appended "1970-01-01"'></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Guess time variables based on naming pattern</h1> <h1>Guess time variables based on naming pattern</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/ds2dd_detailed.R" class="external-link"><code>R/ds2dd_detailed.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>guess_time_only.Rd</code></div> <div class="d-none name"><code>guess_time_only.Rd</code></div>
</div> </div>
@ -142,7 +142,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,93 @@
# Guess time variables based on naming pattern
This is for repairing data with time variables with appended
"1970-01-01"
## Usage
``` r
guess_time_only(
data,
validate.time = FALSE,
time.var.sel.pos = "[Tt]i[d(me)]",
time.var.sel.neg = "[Dd]at[eo]"
)
```
## Arguments
- data:
data.frame or tibble
- validate.time:
Flag to validate guessed time columns
- time.var.sel.pos:
Positive selection regex string passed to \`gues_time_only_filter()\`
as sel.pos.
- time.var.sel.neg:
Negative selection regex string passed to \`gues_time_only_filter()\`
as sel.neg.
## Value
data.frame or tibble
## Examples
``` r
redcapcast_data |> guess_time_only(validate.time = TRUE)
#> $is.POSIX
#> # A tibble: 25 × 2
#> inclusion_time event_datetime
#> <time> <dttm>
#> 1 12:38:49 NA
#> 2 10:38:57 NA
#> 3 NA NA
#> 4 NA 2024-01-18 12:49:42
#> 5 12:01:07 NA
#> 6 NA NA
#> 7 NA NA
#> 8 NA 2024-01-18 12:49:58
#> 9 NA 2024-01-18 12:50:01
#> 10 NA 2024-01-18 12:50:05
#> # 15 more rows
#>
#> $is.datetime
#> # A tibble: 25 × 1
#> event_datetime
#> <dttm>
#> 1 NA
#> 2 NA
#> 3 NA
#> 4 2024-01-18 12:49:42
#> 5 NA
#> 6 NA
#> 7 NA
#> 8 2024-01-18 12:49:58
#> 9 2024-01-18 12:50:01
#> 10 2024-01-18 12:50:05
#> # 15 more rows
#>
#> $is.time_only
#> # A tibble: 25 × 1
#> inclusion_time
#> <time>
#> 1 12:38:49
#> 2 10:38:57
#> 3 NA
#> 4 NA
#> 5 12:01:07
#> 6 NA
#> 7 NA
#> 8 NA
#> 9 NA
#> 10 NA
#> # 15 more rows
#>
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Try at determining which are true time only variables — guess_time_only_filter • 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="Try at determining which are true time only variables — guess_time_only_filter"><meta name="description" content='This is just a try at guessing data type based on data class and column names <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Try at determining which are true time only variables — guess_time_only_filter • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Try at determining which are true time only variables — guess_time_only_filter"><meta name="description" content='This is just a try at guessing data type based on data class and column names
hoping for a tiny bit of naming consistency. R does not include a time-only hoping for a tiny bit of naming consistency. R does not include a time-only
data format natively, so the "hms" class from `readr` is used. This data format natively, so the "hms" class from `readr` is used. This
has to be converted to character class before REDCap upload.'><meta property="og:description" content='This is just a try at guessing data type based on data class and column names has to be converted to character class before REDCap upload.'><meta property="og:description" content='This is just a try at guessing data type based on data class and column names
@ -13,7 +13,7 @@ has to be converted to character class before REDCap upload.'></head><body>
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -41,7 +41,7 @@ has to be converted to character class before REDCap upload.'></head><body>
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Try at determining which are true time only variables</h1> <h1>Try at determining which are true time only variables</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/ds2dd_detailed.R" class="external-link"><code>R/ds2dd_detailed.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>guess_time_only_filter.Rd</code></div> <div class="d-none name"><code>guess_time_only_filter.Rd</code></div>
</div> </div>
@ -139,7 +139,7 @@ has to be converted to character class before REDCap upload.</p>
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,83 @@
# Try at determining which are true time only variables
This is just a try at guessing data type based on data class and column
names hoping for a tiny bit of naming consistency. R does not include a
time-only data format natively, so the "hms" class from \`readr\` is
used. This has to be converted to character class before REDCap upload.
## Usage
``` r
guess_time_only_filter(
data,
validate = FALSE,
sel.pos = "[Tt]i[d(me)]",
sel.neg = "[Dd]at[eo]"
)
```
## Arguments
- data:
data set
- validate:
flag to output validation data. Will output list.
- sel.pos:
Positive selection regex string
- sel.neg:
Negative selection regex string
## Value
character vector or list depending on \`validate\` flag.
## Examples
``` r
data <- redcapcast_data
data |> guess_time_only_filter()
#> [1] "inclusion_time"
data |>
guess_time_only_filter(validate = TRUE) |>
lapply(head)
#> $is.POSIX
#> # A tibble: 6 × 2
#> inclusion_time event_datetime
#> <time> <dttm>
#> 1 12:38:49 NA
#> 2 10:38:57 NA
#> 3 NA NA
#> 4 NA 2024-01-18 12:49:42
#> 5 12:01:07 NA
#> 6 NA NA
#>
#> $is.datetime
#> # A tibble: 6 × 1
#> event_datetime
#> <dttm>
#> 1 NA
#> 2 NA
#> 3 NA
#> 4 2024-01-18 12:49:42
#> 5 NA
#> 6 NA
#>
#> $is.time_only
#> # A tibble: 6 × 1
#> inclusion_time
#> <time>
#> 1 12:38:49
#> 2 10:38:57
#> 3 NA
#> 4 NA
#> 5 12:01:07
#> 6 NA
#>
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Finish incomplete haven attributes substituting missings with values — haven_all_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="Finish incomplete haven attributes substituting missings with values — haven_all_levels"><meta name="description" content="Finish incomplete haven attributes substituting missings with values"><meta property="og:description" content="Finish incomplete haven attributes substituting missings with values"></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Finish incomplete haven attributes substituting missings with values — haven_all_levels • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Finish incomplete haven attributes substituting missings with values — haven_all_levels"><meta name="description" content="Finish incomplete haven attributes substituting missings with values"><meta property="og:description" content="Finish incomplete haven attributes substituting missings with values"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Finish incomplete haven attributes substituting missings with values</h1> <h1>Finish incomplete haven attributes substituting missings with values</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/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/as_factor.R" class="external-link"><code>R/as_factor.R</code></a></small>
<div class="d-none name"><code>haven_all_levels.Rd</code></div> <div class="d-none name"><code>haven_all_levels.Rd</code></div>
</div> </div>
@ -91,7 +91,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,41 @@
# Finish incomplete haven attributes substituting missings with values
Finish incomplete haven attributes substituting missings with values
## Usage
``` r
haven_all_levels(data)
```
## Arguments
- data:
haven labelled variable
## Value
named vector
## Examples
``` r
ds <- structure(c(1, 2, 3, 2, 10, 9),
labels = c(Unknown = 9, Refused = 10),
class = "haven_labelled"
)
haven::is.labelled(ds)
#> [1] TRUE
attributes(ds)
#> $labels
#> Unknown Refused
#> 9 10
#>
#> $class
#> [1] "haven_labelled"
#>
ds |> haven_all_levels()
#> 1 2 3 Unknown Refused
#> 1 2 3 9 10
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!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>Change "hms" to "character" for REDCap upload. — hms2character • 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="Change " hms to for redcap upload. hms2character><meta name="description" content='Change "hms" to "character" for REDCap upload.'><meta property="og:description" content='Change "hms" to "character" for REDCap upload.'></head><body> <!-- Generated by pkgdown: do not edit by hand --><html lang="en-US"><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>Change "hms" to "character" for REDCap upload. — hms2character • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/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="Change " hms to for redcap upload. hms2character><meta name="description" content='Change "hms" to "character" for REDCap upload.'><meta property="og:description" content='Change "hms" to "character" for REDCap upload.'></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a> <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -7,7 +7,7 @@
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a> <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="">25.3.2</small> <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">25.11.1</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"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header"> <main id="main" class="col-md-9"><div class="page-header">
<h1>Change "hms" to "character" for REDCap upload.</h1> <h1>Change "hms" to "character" for REDCap upload.</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/ds2dd_detailed.R" class="external-link"><code>R/ds2dd_detailed.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>hms2character.Rd</code></div> <div class="d-none name"><code>hms2character.Rd</code></div>
</div> </div>
@ -76,7 +76,7 @@
</div> </div>
<div class="pkgdown-footer-right"> <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> <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div> </div>
</footer></div> </footer></div>

View file

@ -0,0 +1,26 @@
# Change "hms" to "character" for REDCap upload.
Change "hms" to "character" for REDCap upload.
## Usage
``` r
hms2character(data)
```
## Arguments
- data:
data set
## Value
data.frame or tibble
## Examples
``` r
data <- redcapcast_data
## data |> time_only_correction() |> hms2character()
```

Some files were not shown because too many files have changed in this diff Show more