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

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

View file

@ -1,5 +1,5 @@
<!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
)."><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
@ -11,7 +11,7 @@
<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">
@ -39,7 +39,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -72,7 +72,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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
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
@ -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>
<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">
@ -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">
<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>
@ -167,7 +167,7 @@ instruments only or for all forms.</p></dd>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -76,7 +76,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -74,7 +74,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -74,7 +74,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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
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
@ -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>
<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">
@ -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">
<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>
@ -165,7 +165,7 @@ To avoid redundancy calls and errors, functions are copy-pasted here</p>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -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-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-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> [16] 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 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-out co"><span class="r-pr">#&gt;</span> [1] FALSE</span>
</code></pre></div>
@ -124,7 +124,7 @@ interpreted as TRUE.</p></dd>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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
order of priority.
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>
<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">
@ -43,7 +43,7 @@ naming."></head><body>
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -99,7 +99,7 @@ naming.</p>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -70,7 +70,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -70,7 +70,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -89,7 +89,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -98,7 +98,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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;')."></head><body>
<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>
<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">
@ -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">
<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>
@ -79,7 +79,7 @@ and save the first paragraph ('&lt;p&gt;...&lt;/p&gt;').</p>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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.
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.
@ -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>
<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">
@ -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">
<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>
@ -82,7 +82,7 @@ Trying to make up for different naming conventions.</p>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -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-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-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>
</div>
</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 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>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -83,7 +83,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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
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
@ -13,7 +13,7 @@ production."></head><body>
<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">
@ -41,7 +41,7 @@ production."></head><body>
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -54,7 +54,7 @@ production.</p>
<div class="section level2">
<h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">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 class="section level2">
@ -117,7 +117,7 @@ Default is TRUE.</p></dd>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -80,7 +80,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -110,7 +110,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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
an easier to use data base creation. This approach allows easier
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>
<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">
@ -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">
<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>
@ -171,7 +171,7 @@ Character vector.</p></dd>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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."></head><body>
<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>
<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">
@ -37,7 +37,7 @@ for a more advanced function."></head><body>
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -309,7 +309,7 @@ names(REDCapCAST::redcapcast_meta).</p></dd>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -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;"># 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;"># 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;"># 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;"># 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;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>
<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> field_name form_name section_header field_type field_label </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;lgl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> record_id b <span style="color: #BB0000;">NA</span> text record_id </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">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;">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;">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;">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;">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 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 b <span style="color: #BB0000;">NA</span> radio Species </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 13 more variables: select_choices_or_calculations &lt;chr&gt;, field_note &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># text_validation_type_or_show_slider_number &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># text_validation_min &lt;lgl&gt;, text_validation_max &lt;lgl&gt;, identifier &lt;lgl&gt;,</span></span>
@ -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;">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;"># 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> $meta</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> field_name form_name section_header field_type field_label</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;lgl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> record_id 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;">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;">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;">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 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;">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>
@ -355,7 +355,7 @@ Please, do always inspect the data dictionary before upload.</p>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -108,7 +108,7 @@ data.</p></dd>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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
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
@ -13,7 +13,7 @@ production."></head><body>
<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">
@ -41,7 +41,7 @@ production."></head><body>
<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>
<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>
@ -116,7 +116,7 @@ just using the first.</p></dd>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -101,7 +101,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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()]."></head><body>
<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>
<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">
@ -37,7 +37,7 @@ replaces [base::droplevels()]."></head><body>
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -136,7 +136,7 @@ replaces [base::droplevels()].</p>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -63,7 +63,7 @@
<div class="section level2">
<h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="fu">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-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>
@ -78,7 +78,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -74,7 +74,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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."></head><body>
<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>
<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">
@ -37,7 +37,7 @@ coerce to a factor."></head><body>
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -71,7 +71,7 @@ coerce to a factor.</p>
<div class="section level2">
<h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="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> First. second THIRD </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 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>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -80,7 +80,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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
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
@ -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>
<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">
@ -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">
<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>
@ -80,7 +80,7 @@ sense. Wrapping <a href="https://keyring.r-lib.org/reference/key_get.html" class
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -88,7 +88,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -70,7 +70,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -142,7 +142,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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
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
@ -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>
<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">
@ -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">
<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>
@ -139,7 +139,7 @@ has to be converted to character class before REDCap upload.</p>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -91,7 +91,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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>
<!-- 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>
@ -7,7 +7,7 @@
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<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>
@ -76,7 +76,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</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()
```

View file

@ -1,5 +1,5 @@
<!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 html tag wrapping for REDCap text formatting — html_tag_wrap • 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 html tag wrapping for REDCap text formatting — html_tag_wrap"><meta name="description" content="Simple html tag wrapping for REDCap text formatting"><meta property="og:description" content="Simple html tag wrapping for REDCap text formatting"></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 html tag wrapping for REDCap text formatting — html_tag_wrap • 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 html tag wrapping for REDCap text formatting — html_tag_wrap"><meta name="description" content="Simple html tag wrapping for REDCap text formatting"><meta property="og:description" content="Simple html tag wrapping for REDCap text formatting"></head><body>
<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>
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<h1>Simple html tag wrapping for REDCap text formatting</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>html_tag_wrap.Rd</code></div>
</div>
@ -86,7 +86,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div>
</footer></div>

View file

@ -0,0 +1,36 @@
# Simple html tag wrapping for REDCap text formatting
Simple html tag wrapping for REDCap text formatting
## Usage
``` r
html_tag_wrap(data, tag = "h2", extra = NULL)
```
## Arguments
- data:
character vector
- tag:
character vector length 1
- extra:
character vector
## Value
character vector
## Examples
``` r
html_tag_wrap("Titel", tag = "div", extra = 'class="rich-text-field-label"')
#> <div class="rich-text-field-label">Titel</div>
html_tag_wrap("Titel", tag = "h2")
#> <h2>Titel</h2>
```

View file

@ -1,5 +1,5 @@
<!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>Package index • 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="Package index"></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>Package index • 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="Package index"></head><body>
<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>
<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">
@ -42,8 +42,7 @@
</div><div class="section level2">
<dl></dl></div><div class="section level2">
@ -54,415 +53,484 @@
</dt>
<dd>Split REDCap repeating instruments table into multiple tables</dd>
</dl><dl><dt>
<dt>
<code><a href="all_na.html">all_na()</a></code>
</dt>
<dd>Check if vector is all NA</dd>
</dl><dl><dt>
<dt>
<code><a href="apply_factor_labels.html">apply_factor_labels()</a></code>
</dt>
<dd>Preserve all factor levels from REDCap data dictionary in data export</dd>
</dl><dl><dt>
<dt>
<code><a href="apply_field_label.html">apply_field_label()</a></code>
</dt>
<dd>Apply REDCap filed labels to data frame</dd>
</dl><dl><dt>
<dt>
<code><a href="as_factor.html">as_factor()</a></code>
</dt>
<dd>Convert labelled vectors to factors while preserving attributes</dd>
</dl><dl><dt>
<dt>
<code><a href="as_logical.html">as_logical()</a></code>
</dt>
<dd>Interpret specific binary values as logicals</dd>
</dl><dl><dt>
<dt>
<code><a href="case_match_regex_list.html">case_match_regex_list()</a></code>
</dt>
<dd>List-base regex case_when</dd>
</dl><dl><dt>
<dt>
<code><a href="cast_data_overview.html">cast_data_overview()</a></code>
</dt>
<dd>Overview of REDCapCAST data for shiny</dd>
</dl><dl><dt>
<dt>
<code><a href="cast_meta_overview.html">cast_meta_overview()</a></code>
</dt>
<dd>Overview of REDCapCAST meta data for shiny</dd>
</dl><dl><dt>
<dt>
<code><a href="char2choice.html">char2choice()</a></code>
</dt>
<dd>Simple function to generate REDCap choices from character vector</dd>
</dl><dl><dt>
<dt>
<code><a href="char2cond.html">char2cond()</a></code>
</dt>
<dd>Simple function to generate REDCap branching logic from character vector</dd>
</dl><dl><dt>
<dt>
<code><a href="clean_field_label.html">clean_field_label()</a></code>
</dt>
<dd>Very simple function to remove rich text formatting from field label and save the first paragraph ('&lt;p&gt;...&lt;/p&gt;').</dd>
</dl><dl><dt>
<dt>
<code><a href="clean_redcap_name.html">clean_redcap_name()</a></code>
</dt>
<dd>clean_redcap_name</dd>
</dl><dl><dt>
<dt>
<code><a href="compact_vec.html">compact_vec()</a></code>
</dt>
<dd>Compacting a vector of any length with or without names</dd>
</dl><dl><dt>
<dt>
<code><a href="create_html_table.html">create_html_table()</a></code>
</dt>
<dd>Create two-column HTML table for data piping in REDCap instruments</dd>
</dl><dl><dt>
<dt>
<code><a href="create_instrument_meta.html">create_instrument_meta()</a></code>
</dt>
<dd>DEPRICATED Create zips file with necessary content based on data set</dd>
</dl><dl><dt>
<dt>
<code><a href="cut_string_length.html">cut_string_length()</a></code>
</dt>
<dd>Cut string to desired length</dd>
</dl><dl><dt>
<dt>
<code><a href="d2w.html">d2w()</a></code>
</dt>
<dd>Convert single digits to words</dd>
</dl><dl><dt>
<dt>
<code><a href="doc2dd.html">doc2dd()</a></code>
</dt>
<dd>Doc table to data dictionary - EARLY, DOCS MISSING</dd>
</dl><dl><dt>
<dt>
<code><a href="ds2dd.html">ds2dd()</a></code>
</dt>
<dd>(DEPRECATED) Data set to data dictionary function</dd>
</dl><dl><dt>
<dt>
<code><a href="ds2dd_detailed.html">ds2dd_detailed()</a></code>
</dt>
<dd>Extract data from stata file for data dictionary</dd>
</dl><dl><dt>
<dt>
<code><a href="easy_redcap.html">easy_redcap()</a></code>
</dt>
<dd>Secure API key storage and data acquisition in one</dd>
</dl><dl><dt>
<dt>
<code><a href="export_redcap_instrument.html">export_redcap_instrument()</a></code>
</dt>
<dd>Creates zip-file with necessary content to manually add instrument to database</dd>
</dl><dl><dt>
<dt>
<code><a href="fct2num.html">fct2num()</a></code>
</dt>
<dd>Allows conversion of factor to numeric values preserving original levels</dd>
</dl><dl><dt>
<dt>
<code><a href="fct_drop.html">fct_drop()</a></code>
</dt>
<dd>Drop unused levels preserving label data</dd>
</dl><dl><dt>
<dt>
<code><a href="file_extension.html">file_extension()</a></code>
</dt>
<dd>DEPRECATED Helper to import files correctly</dd>
</dl><dl><dt>
<dt>
<code><a href="focused_metadata.html">focused_metadata()</a></code>
</dt>
<dd>focused_metadata</dd>
</dl><dl><dt>
<dt>
<code><a href="format_redcap_factor.html">format_redcap_factor()</a></code>
</dt>
<dd>Converts REDCap choices to factor levels and stores in labels attribute</dd>
</dl><dl><dt>
<dt>
<code><a href="format_subheader.html">format_subheader()</a></code>
</dt>
<dd>Sub-header formatting wrapper</dd>
</dl><dl><dt>
<dt>
<code><a href="get_api_key.html">get_api_key()</a></code>
</dt>
<dd>Retrieve project API key if stored, if not, set and retrieve</dd>
</dl><dl><dt>
<dt>
<code><a href="get_attr.html">get_attr()</a></code>
</dt>
<dd>Extract attribute. Returns NA if none</dd>
</dl><dl><dt>
<dt>
<code><a href="get_id_name.html">get_id_name()</a></code>
</dt>
<dd>Get the id name</dd>
</dl><dl><dt>
<dt>
<code><a href="guess_time_only.html">guess_time_only()</a></code>
</dt>
<dd>Guess time variables based on naming pattern</dd>
</dl><dl><dt>
<dt>
<code><a href="guess_time_only_filter.html">guess_time_only_filter()</a></code>
</dt>
<dd>Try at determining which are true time only variables</dd>
</dl><dl><dt>
<dt>
<code><a href="haven_all_levels.html">haven_all_levels()</a></code>
</dt>
<dd>Finish incomplete haven attributes substituting missings with values</dd>
</dl><dl><dt>
<dt>
<code><a href="hms2character.html">hms2character()</a></code>
</dt>
<dd>Change "hms" to "character" for REDCap upload.</dd>
</dl><dl><dt>
<dt>
<code><a href="html_tag_wrap.html">html_tag_wrap()</a></code>
</dt>
<dd>Simple html tag wrapping for REDCap text formatting</dd>
</dl><dl><dt>
<dt>
<code><a href="is.labelled.html">is.labelled()</a></code>
</dt>
<dd>Tests for multiple label classes</dd>
</dl><dl><dt>
<dt>
<code><a href="is_missing.html">is_missing()</a></code>
</dt>
<dd>Multi missing check</dd>
</dl><dl><dt>
<dt>
<code><a href="is_repeated_longitudinal.html">is_repeated_longitudinal()</a></code>
</dt>
<dd>Test if repeatable or longitudinal</dd>
</dl><dl><dt>
<dt>
<code><a href="mark_complete.html">mark_complete()</a></code>
</dt>
<dd>Completion marking based on completed upload</dd>
</dl><dl><dt>
<dt>
<code><a href="match_fields_to_form.html">match_fields_to_form()</a></code>
</dt>
<dd>Match fields to forms</dd>
</dl><dl><dt>
<dt>
<code><a href="mtcars_redcap.html">mtcars_redcap</a></code>
</dt>
<dd>mtcars dataset slightly modified to use for Shiny app upload demonstration</dd>
</dl><dl><dt>
<dt>
<code><a href="named_levels.html">named_levels()</a></code>
</dt>
<dd>Get named vector of factor levels and values</dd>
</dl><dl><dt>
<dt>
<code><a href="nav_bar_page.html">nav_bar_page()</a></code>
</dt>
<dd>Nav_bar defining function for shiny ui</dd>
</dl><dl><dt>
<dt>
<code><a href="numchar2fct.html">numchar2fct()</a></code>
</dt>
<dd>Applying var2fct across data set</dd>
</dl><dl><dt>
<dt>
<code><a href="parse_data.html">parse_data()</a></code>
</dt>
<dd>Helper to auto-parse un-formatted data with haven and readr</dd>
</dl><dl><dt>
<dt>
<code><a href="possibly_numeric.html">possibly_numeric()</a></code>
</dt>
<dd>Tests if vector can be interpreted as numeric without introducing NAs by coercion</dd>
</dl><dl><dt>
<dt>
<code><a href="possibly_roman.html">possibly_roman()</a></code>
</dt>
<dd>Test if vector can be interpreted as roman numerals</dd>
</dl><dl><dt>
<dt>
<code><a href="process_user_input.html">process_user_input()</a></code>
</dt>
<dd>User input processing</dd>
</dl><dl><dt>
<dt>
<code><a href="process_user_input.character.html">process_user_input(<i>&lt;character&gt;</i>)</a></code>
</dt>
<dd>User input processing character</dd>
</dl><dl><dt>
<dt>
<code><a href="process_user_input.data.frame.html">process_user_input(<i>&lt;data.frame&gt;</i>)</a></code>
</dt>
<dd>User input processing data.frame</dd>
</dl><dl><dt>
<dt>
<code><a href="process_user_input.default.html">process_user_input(<i>&lt;default&gt;</i>)</a></code>
</dt>
<dd>User input processing default</dd>
</dl><dl><dt>
<dt>
<code><a href="process_user_input.response.html">process_user_input(<i>&lt;response&gt;</i>)</a></code>
</dt>
<dd>User input processing response</dd>
</dl><dl><dt>
<dt>
<code><a href="read_input.html">read_input()</a></code>
</dt>
<dd>Flexible file import based on extension</dd>
</dl><dl><dt>
<dt>
<code><a href="read_redcap_instrument.html">read_redcap_instrument()</a></code>
</dt>
<dd>Convenience function to download complete instrument, using token storage in keyring.</dd>
</dl><dl><dt>
<dt>
<code><a href="read_redcap_tables.html">read_redcap_tables()</a></code>
</dt>
<dd>Download REDCap data</dd>
</dl><dl><dt>
<dt>
<code><a href="redcap_wider.html">redcap_wider()</a></code>
</dt>
<dd>Transforms list of REDCap data.frames to a single wide data.frame</dd>
</dl><dl><dt>
<dt>
<code><a href="redcapcast_data.html">redcapcast_data</a></code>
</dt>
<dd>Data set for demonstration</dd>
</dl><dl><dt>
<dt>
<code><a href="redcapcast_meta.html">redcapcast_meta</a></code>
</dt>
<dd>REDCap metadata from data base</dd>
</dl><dl><dt>
<dt>
<code><a href="replace_curly_quote.html">replace_curly_quote()</a></code>
</dt>
<dd>Replace curly apostrophes and quotes from word</dd>
</dl><dl><dt>
<dt>
<code><a href="sanitize_split.html">sanitize_split()</a></code>
</dt>
<dd>Sanitize list of data frames</dd>
</dl><dl><dt>
<dt>
<code><a href="set_attr.html">set_attr()</a></code>
</dt>
<dd>Set attributes for named attribute. Appends if attr is NULL</dd>
</dl><dl><dt>
<dt>
<code><a href="shiny_cast.html">shiny_cast()</a></code>
</dt>
<dd>Launch the included Shiny-app for database casting and upload</dd>
</dl><dl><dt>
<dt>
<code><a href="split_non_repeating_forms.html">split_non_repeating_forms()</a></code>
</dt>
<dd>Split a data frame into separate tables for each form</dd>
</dl><dl><dt>
<dt>
<code><a href="strsplitx.html">strsplitx()</a></code>
</dt>
<dd>Extended string splitting</dd>
</dl><dl><dt>
<dt>
<code><a href="suffix2label.html">suffix2label()</a></code>
</dt>
<dd>Transfer variable name suffix to label in widened data</dd>
</dl><dl><dt>
<dt>
<code><a href="time_only_correction.html">time_only_correction()</a></code>
</dt>
<dd>Correction based on time_only_filter function</dd>
</dl><dl><dt>
<dt>
<code><a href="var2fct.html">var2fct()</a></code>
</dt>
<dd>Convert vector to factor based on threshold of number of unique levels</dd>
</dl><dl><dt>
<dt>
<code><a href="vec2choice.html">vec2choice()</a></code>
@ -477,7 +545,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div>
</footer></div>

154
reference/index.md Normal file
View file

@ -0,0 +1,154 @@
# 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()\`)

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Tests for multiple label classes — is.labelled • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Tests for multiple label classes — is.labelled"><meta name="description" content="Tests for multiple label classes"><meta property="og:description" content="Tests for multiple label classes"></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>Tests for multiple label classes — is.labelled • 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="Tests for multiple label classes — is.labelled"><meta name="description" content="Tests for multiple label classes"><meta property="og:description" content="Tests for multiple label classes"></head><body>
<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>
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<h1>Tests for multiple label classes</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>is.labelled.Rd</code></div>
</div>
@ -83,7 +83,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div>
</footer></div>

33
reference/is.labelled.md Normal file
View file

@ -0,0 +1,33 @@
# Tests for multiple label classes
Tests for multiple label classes
## Usage
``` r
is.labelled(x, classes = c("haven_labelled", "labelled"))
```
## Arguments
- x:
data
- classes:
classes to test
## Value
logical
## Examples
``` r
structure(c(1, 2, 3, 2, 10, 9),
labels = c(Unknown = 9, Refused = 10),
class = "haven_labelled"
) |> is.labelled()
#> [1] TRUE
```

View file

@ -1,5 +1,5 @@
<!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>Multi missing check — is_missing • 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="Multi missing check — is_missing"><meta name="description" content="Multi missing check"><meta property="og:description" content="Multi missing check"></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>Multi missing check — is_missing • 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="Multi missing check — is_missing"><meta name="description" content="Multi missing check"><meta property="og:description" content="Multi missing check"></head><body>
<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>
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<h1>Multi missing check</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>is_missing.Rd</code></div>
</div>
@ -74,7 +74,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div>
</footer></div>

23
reference/is_missing.md Normal file
View file

@ -0,0 +1,23 @@
# Multi missing check
Multi missing check
## Usage
``` r
is_missing(data, nas = c("", "NA"))
```
## Arguments
- data:
character vector
- nas:
character vector of strings considered as NA
## Value
logical vector

View file

@ -1,5 +1,5 @@
<!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>Test if repeatable or longitudinal — is_repeated_longitudinal • 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="Test if repeatable or longitudinal — is_repeated_longitudinal"><meta name="description" content="Test if repeatable or longitudinal"><meta property="og:description" content="Test if repeatable or longitudinal"></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>Test if repeatable or longitudinal — is_repeated_longitudinal • 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="Test if repeatable or longitudinal — is_repeated_longitudinal"><meta name="description" content="Test if repeatable or longitudinal"><meta property="og:description" content="Test if repeatable or longitudinal"></head><body>
<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>
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<h1>Test if repeatable or longitudinal</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>is_repeated_longitudinal.Rd</code></div>
</div>
@ -88,7 +88,7 @@ and "redcap_repeat_instance"</p></dd>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div>
</footer></div>

View file

@ -0,0 +1,38 @@
# Test if repeatable or longitudinal
Test if repeatable or longitudinal
## Usage
``` r
is_repeated_longitudinal(
data,
generics = c("redcap_event_name", "redcap_repeat_instrument", "redcap_repeat_instance")
)
```
## Arguments
- data:
data set
- generics:
default is "redcap_event_name", "redcap_repeat_instrument" and
"redcap_repeat_instance"
## Value
logical
## Examples
``` r
is_repeated_longitudinal(c("record_id", "age", "record_id", "gender"))
#> [1] FALSE
is_repeated_longitudinal(redcapcast_data)
#> [1] TRUE
is_repeated_longitudinal(list(redcapcast_data))
#> [1] TRUE
```

View file

@ -1,5 +1,5 @@
<!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>Completion marking based on completed upload — mark_complete • 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="Completion marking based on completed upload — mark_complete"><meta name="description" content="Completion marking based on completed upload"><meta property="og:description" content="Completion marking based on completed 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>Completion marking based on completed upload — mark_complete • 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="Completion marking based on completed upload — mark_complete"><meta name="description" content="Completion marking based on completed upload"><meta property="og:description" content="Completion marking based on completed upload"></head><body>
<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>
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<h1>Completion marking based on completed 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>mark_complete.Rd</code></div>
</div>
@ -74,7 +74,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div>
</footer></div>

View file

@ -0,0 +1,23 @@
# Completion marking based on completed upload
Completion marking based on completed upload
## Usage
``` r
mark_complete(upload, ls)
```
## Arguments
- upload:
output list from \`REDCapR::redcap_write()\`
- ls:
output list from \`ds2dd_detailed()\`
## Value
list with \`REDCapR::redcap_write()\` results

View file

@ -1,5 +1,5 @@
<!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>Match fields to forms — match_fields_to_form • 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="Match fields to forms — match_fields_to_form"><meta name="description" content="Match fields to forms"><meta property="og:description" content="Match fields to forms"></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>Match fields to forms — match_fields_to_form • 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="Match fields to forms — match_fields_to_form"><meta name="description" content="Match fields to forms"><meta property="og:description" content="Match fields to forms"></head><body>
<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>
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<h1>Match fields to forms</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>match_fields_to_form.Rd</code></div>
</div>
@ -74,7 +74,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div>
</footer></div>

View file

@ -0,0 +1,23 @@
# Match fields to forms
Match fields to forms
## Usage
``` r
match_fields_to_form(metadata, vars_in_data)
```
## Arguments
- metadata:
A data frame containing field names and form names
- vars_in_data:
A character vector of variable names
## Value
A data frame containing field names and form names

View file

@ -1,5 +1,5 @@
<!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>mtcars dataset slightly modified to use for Shiny app upload demonstration — mtcars_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="mtcars dataset slightly modified to use for Shiny app upload demonstration — mtcars_redcap"><meta name="description" content="mtcars dataset slightly modified to use for Shiny app upload demonstration"><meta property="og:description" content="mtcars dataset slightly modified to use for Shiny app upload demonstration"></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>mtcars dataset slightly modified to use for Shiny app upload demonstration — mtcars_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="mtcars dataset slightly modified to use for Shiny app upload demonstration — mtcars_redcap"><meta name="description" content="mtcars dataset slightly modified to use for Shiny app upload demonstration"><meta property="og:description" content="mtcars dataset slightly modified to use for Shiny app upload demonstration"></head><body>
<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>
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<h1>mtcars dataset slightly modified to use for Shiny app upload demonstration</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/v25.3.2/R/mtcars_redcap.R" class="external-link"><code>R/mtcars_redcap.R</code></a></small>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/mtcars_redcap.R" class="external-link"><code>R/mtcars_redcap.R</code></a></small>
<div class="d-none name"><code>mtcars_redcap.Rd</code></div>
</div>
@ -102,7 +102,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div>
</footer></div>

View file

@ -0,0 +1,66 @@
# mtcars dataset slightly modified to use for Shiny app upload demonstration
mtcars dataset slightly modified to use for Shiny app upload
demonstration
## Usage
``` r
data(mtcars_redcap)
```
## Format
A data frame with 13 variables:
- record_id:
ID, numeric
- mpg:
ID, numeric
- cyl:
ID, numeric
- disp:
ID, numeric
- hp:
ID, numeric
- drat:
ID, numeric
- wt:
ID, numeric
- qsec:
ID, numeric
- vs:
ID, numeric
- am:
ID, numeric
- gear:
ID, numeric
- carb:
ID, numeric
- name:
original rownames, charater

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Get named vector of factor levels and values — named_levels • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Get named vector of factor levels and values — named_levels"><meta name="description" content="Get named vector of factor levels and values"><meta property="og:description" content="Get named vector of factor levels and values"></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 named vector of factor levels and values — named_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="Get named vector of factor levels and values — named_levels"><meta name="description" content="Get named vector of factor levels and values"><meta property="og:description" content="Get named vector of factor levels and values"></head><body>
<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>
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<h1>Get named vector of factor levels and 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>named_levels.Rd</code></div>
</div>
@ -113,7 +113,7 @@ Default is 99.</p></dd>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div>
</footer></div>

62
reference/named_levels.md Normal file
View file

@ -0,0 +1,62 @@
# Get named vector of factor levels and values
Get named vector of factor levels and values
## Usage
``` r
named_levels(
data,
label = "labels",
na.label = NULL,
na.value = 99,
sort.numeric = TRUE
)
```
## Arguments
- data:
factor
- label:
character string of attribute with named vector of factor labels
- na.label:
character string to refactor NA values. Default is NULL.
- na.value:
new value for NA strings. Ignored if na.label is NULL. Default is 99.
- sort.numeric:
sort factor levels if levels are numeric. Default is TRUE
## Value
named vector
## Examples
``` r
structure(c(1, 2, 3, 2, 10, 9),
labels = c(Unknown = 9, Refused = 10),
class = "haven_labelled"
) |>
as_factor() |>
named_levels()
#> 1 2 3 Refused Unknown
#> 1 2 3 10 9
structure(c(1, 2, 3, 2, 10, 9),
labels = c(Unknown = 9, Refused = 10),
class = "labelled"
) |>
as_factor() |>
named_levels()
#> 1 2 3 Refused Unknown
#> 1 2 3 10 9
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Nav_bar defining function for shiny ui — nav_bar_page • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Nav_bar defining function for shiny ui — nav_bar_page"><meta name="description" content="Nav_bar defining function for shiny ui"><meta property="og:description" content="Nav_bar defining function for shiny ui"></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>Nav_bar defining function for shiny ui — nav_bar_page • 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="Nav_bar defining function for shiny ui — nav_bar_page"><meta name="description" content="Nav_bar defining function for shiny ui"><meta property="og:description" content="Nav_bar defining function for shiny ui"></head><body>
<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>
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<h1>Nav_bar defining function for shiny ui</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>nav_bar_page.Rd</code></div>
</div>
@ -62,7 +62,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div>
</footer></div>

13
reference/nav_bar_page.md Normal file
View file

@ -0,0 +1,13 @@
# Nav_bar defining function for shiny ui
Nav_bar defining function for shiny ui
## Usage
``` r
nav_bar_page()
```
## Value
shiny object

View file

@ -1,5 +1,5 @@
<!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>Applying var2fct across data set — numchar2fct • 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="Applying var2fct across data set — numchar2fct"><meta name="description" content="Individual thresholds for character and numeric columns"><meta property="og:description" content="Individual thresholds for character and numeric columns"></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>Applying var2fct across data set — numchar2fct • 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="Applying var2fct across data set — numchar2fct"><meta name="description" content="Individual thresholds for character and numeric columns"><meta property="og:description" content="Individual thresholds for character and numeric columns"></head><body>
<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>
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<h1>Applying var2fct across data set</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>numchar2fct.Rd</code></div>
</div>
@ -102,7 +102,7 @@ Default is 6.</p></dd>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div>
</footer></div>

50
reference/numchar2fct.md Normal file
View file

@ -0,0 +1,50 @@
# Applying var2fct across data set
Individual thresholds for character and numeric columns
## Usage
``` r
numchar2fct(data, numeric.threshold = 6, character.throshold = 6)
```
## Arguments
- data:
dataset. data.frame or tibble
- numeric.threshold:
threshold for var2fct for numeric columns. Default is 6.
- character.throshold:
threshold for var2fct for character columns. Default is 6.
## Value
data.frame or tibble
## Examples
``` 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 ...
if (FALSE) { # \dontrun{
mtcars |>
numchar2fct(numeric.threshold = 6) |>
str()
} # }
```

View file

@ -1,5 +1,5 @@
<!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>Helper to auto-parse un-formatted data with haven and readr — parse_data • 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="Helper to auto-parse un-formatted data with haven and readr — parse_data"><meta name="description" content="Helper to auto-parse un-formatted data with haven and readr"><meta property="og:description" content="Helper to auto-parse un-formatted data with haven and readr"></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>Helper to auto-parse un-formatted data with haven and readr — parse_data • 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="Helper to auto-parse un-formatted data with haven and readr — parse_data"><meta name="description" content="Helper to auto-parse un-formatted data with haven and readr"><meta property="og:description" content="Helper to auto-parse un-formatted data with haven and readr"></head><body>
<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>
<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">
@ -35,7 +35,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<h1>Helper to auto-parse un-formatted data with haven and readr</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>parse_data.Rd</code></div>
</div>
@ -116,7 +116,7 @@
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div>
</footer></div>

66
reference/parse_data.md Normal file
View file

@ -0,0 +1,66 @@
# Helper to auto-parse un-formatted data with haven and readr
Helper to auto-parse un-formatted data with haven and readr
## Usage
``` r
parse_data(
data,
guess_type = TRUE,
col_types = NULL,
locale = readr::default_locale(),
ignore.vars = "cpr",
...
)
```
## Arguments
- data:
data.frame or tibble
- guess_type:
logical to guess type with readr
- col_types:
specify col_types using readr semantics. Ignored if guess_type is TRUE
- locale:
option to specify locale. Defaults to readr::default_locale().
- ignore.vars:
specify column names of columns to ignore when parsing
- ...:
ignored
## Value
data.frame or tibble
## Examples
``` r
mtcars |>
parse_data() |>
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 ...
```

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Tests if vector can be interpreted as numeric without introducing NAs by coercion — possibly_numeric • REDCapCAST</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Tests if vector can be interpreted as numeric without introducing NAs by coercion — possibly_numeric"><meta name="description" content="Tests if vector can be interpreted as numeric without introducing NAs by
<!-- 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>Tests if vector can be interpreted as numeric without introducing NAs by coercion — possibly_numeric • 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="Tests if vector can be interpreted as numeric without introducing NAs by coercion — possibly_numeric"><meta name="description" content="Tests if vector can be interpreted as numeric without introducing NAs by
coercion"><meta property="og:description" content="Tests if vector can be interpreted as numeric without introducing NAs by
coercion"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@ -9,7 +9,7 @@ coercion"></head><body>
<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">
@ -37,7 +37,7 @@ coercion"></head><body>
<main id="main" class="col-md-9"><div class="page-header">
<h1>Tests if vector can be interpreted as numeric without introducing NAs by coercion</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>possibly_numeric.Rd</code></div>
</div>
@ -81,7 +81,7 @@ coercion</p>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
</div>
</footer></div>

View file

@ -0,0 +1,29 @@
# Tests if vector can be interpreted as numeric without introducing NAs by coercion
Tests if vector can be interpreted as numeric without introducing NAs by
coercion
## Usage
``` r
possibly_numeric(data)
```
## Arguments
- data:
vector
## Value
logical
## Examples
``` r
c("1","5") |> possibly_numeric()
#> [1] TRUE
c("1","5","e") |> possibly_numeric()
#> [1] FALSE
```

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