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

This commit is contained in:
agdamsbo 2024-11-28 20:11:32 +00:00
parent 481b2ab57a
commit f7899cfccb
8 changed files with 303 additions and 174 deletions

View File

@ -108,10 +108,12 @@ to specify only the fields or instruments you need, and avoid to save
any of the data locally, but always source from REDCap to avoid possibly any of the data locally, but always source from REDCap to avoid possibly
insecure local storage of sensitive data.</p> insecure local storage of sensitive data.</p>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/easy_redcap.html">easy_redcap</a></span><span class="op">(</span>uri <span class="op">=</span> <span class="st">"YOUR URI"</span>, </span> <code class="sourceCode R"><span><span class="fu"><a href="../reference/easy_redcap.html">easy_redcap</a></span><span class="op">(</span></span>
<span> project.name <span class="op">=</span> <span class="st">"MY_PROJECT"</span>, </span> <span> uri <span class="op">=</span> <span class="st">"YOUR URI"</span>,</span>
<span> widen.data <span class="op">=</span> <span class="cn">TRUE</span>,</span> <span> project.name <span class="op">=</span> <span class="st">"MY_PROJECT"</span>,</span>
<span> fields <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">"record_id"</span>, <span class="st">"OTHER FIELDS"</span><span class="op">)</span><span class="op">)</span></span></code></pre></div> <span> widen.data <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span> fields <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">"record_id"</span>, <span class="st">"OTHER FIELDS"</span><span class="op">)</span></span>
<span><span class="op">)</span></span></code></pre></div>
</div> </div>
<div class="section level2"> <div class="section level2">
<h2 id="splitting-the-dataset">Splitting the dataset<a class="anchor" aria-label="anchor" href="#splitting-the-dataset"></a> <h2 id="splitting-the-dataset">Splitting the dataset<a class="anchor" aria-label="anchor" href="#splitting-the-dataset"></a>
@ -2232,10 +2234,12 @@ Note: as opposed to the build in datediff() this handles counting years as integ
<p>To save the metadata as labels in the dataset, we can save field <p>To save the metadata as labels in the dataset, we can save field
labels and the choices from radio buttons and dropdown features:</p> labels and the choices from radio buttons and dropdown features:</p>
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">labelled_data</span> <span class="op">&lt;-</span> </span> <code class="sourceCode R"><span><span class="va">labelled_data</span> <span class="op">&lt;-</span></span>
<span> <span class="fu"><a href="../reference/apply_field_label.html">apply_field_label</a></span><span class="op">(</span>data<span class="op">=</span><span class="va">redcapcast_data</span>,</span> <span> <span class="fu"><a href="../reference/apply_field_label.html">apply_field_label</a></span><span class="op">(</span></span>
<span> meta<span class="op">=</span><span class="va">redcapcast_meta</span><span class="op">)</span> <span class="op">|&gt;</span> </span> <span> data <span class="op">=</span> <span class="va">redcapcast_data</span>,</span>
<span> <span class="fu"><a href="../reference/apply_factor_labels.html">apply_factor_labels</a></span><span class="op">(</span>meta<span class="op">=</span><span class="va">redcapcast_meta</span><span class="op">)</span></span></code></pre></div> <span> meta <span class="op">=</span> <span class="va">redcapcast_meta</span></span>
<span> <span class="op">)</span> <span class="op">|&gt;</span></span>
<span> <span class="fu"><a href="../reference/apply_factor_labels.html">apply_factor_labels</a></span><span class="op">(</span>meta <span class="op">=</span> <span class="va">redcapcast_meta</span><span class="op">)</span></span></code></pre></div>
<p>The <code>REDCap_split</code> function splits the data set into a <p>The <code>REDCap_split</code> function splits the data set into a
list of data.frames.</p> list of data.frames.</p>
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
@ -2244,7 +2248,7 @@ list of data.frames.</p>
<span> records <span class="op">=</span> <span class="va">labelled_data</span>,</span> <span> records <span class="op">=</span> <span class="va">labelled_data</span>,</span>
<span> metadata <span class="op">=</span> <span class="va">redcapcast_meta</span>,</span> <span> metadata <span class="op">=</span> <span class="va">redcapcast_meta</span>,</span>
<span> forms <span class="op">=</span> <span class="st">"all"</span></span> <span> forms <span class="op">=</span> <span class="st">"all"</span></span>
<span> <span class="op">)</span> <span class="op">|&gt;</span> </span> <span> <span class="op">)</span> <span class="op">|&gt;</span></span>
<span> <span class="co"># Next steps cleans up and removes generic columns</span></span> <span> <span class="co"># Next steps cleans up and removes generic columns</span></span>
<span> <span class="fu"><a href="../reference/sanitize_split.html">sanitize_split</a></span><span class="op">(</span><span class="op">)</span></span> <span> <span class="fu"><a href="../reference/sanitize_split.html">sanitize_split</a></span><span class="op">(</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/str.html" class="external-link">str</a></span><span class="op">(</span><span class="va">list</span><span class="op">)</span></span> <span><span class="fu"><a href="https://rdrr.io/r/utils/str.html" class="external-link">str</a></span><span class="op">(</span><span class="va">list</span><span class="op">)</span></span>
@ -2315,127 +2319,133 @@ widen the data, by transforming the list of data.frames to a single
data.frame with one row for each subject/record_id (wide data data.frame with one row for each subject/record_id (wide data
format):</p> format):</p>
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">wide_data</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/redcap_wider.html">redcap_wider</a></span><span class="op">(</span><span class="va">list</span><span class="op">)</span> </span> <code class="sourceCode R"><span><span class="va">wide_data</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/redcap_wider.html">redcap_wider</a></span><span class="op">(</span><span class="va">list</span>,</span>
<span> event.glue <span class="op">=</span> <span class="st">"{.value}____{redcap_event_name}"</span>,</span>
<span> inst.glue <span class="op">=</span> <span class="st">"{.value}____{redcap_repeat_instance}"</span></span>
<span><span class="op">)</span></span>
<span><span class="co">#&gt; Joining with `by = join_by(record_id)`</span></span> <span><span class="co">#&gt; Joining with `by = join_by(record_id)`</span></span>
<span><span class="co">#&gt; Joining with `by = join_by(record_id)`</span></span> <span><span class="co">#&gt; Joining with `by = join_by(record_id)`</span></span>
<span><span class="va">wide_data</span> <span class="op">|&gt;</span> <span class="fu"><a href="https://rdrr.io/r/utils/str.html" class="external-link">str</a></span><span class="op">(</span><span class="op">)</span></span> <span><span class="va">wide_data</span> <span class="op">|&gt;</span> <span class="fu"><a href="https://rdrr.io/r/utils/str.html" class="external-link">str</a></span><span class="op">(</span><span class="op">)</span></span>
<span><span class="co">#&gt; tibble [6 × 49] (S3: tbl_df/tbl/data.frame)</span></span> <span><span class="co">#&gt; tibble [6 × 49] (S3: tbl_df/tbl/data.frame)</span></span>
<span><span class="co">#&gt; $ record_id : num [1:6] 1 2 3 4 5 6</span></span> <span><span class="co">#&gt; $ record_id : num [1:6] 1 2 3 4 5 6</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "ID"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "ID"</span></span>
<span><span class="co">#&gt; $ cpr : chr [1:6] "1203401OB4" "0102342303" "2301569823" "0204051342" ...</span></span> <span><span class="co">#&gt; $ cpr : chr [1:6] "1203401OB4" "0102342303" "2301569823" "0204051342" ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "CPR (Danish civil registration number)"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "CPR (Danish civil registration number)"</span></span>
<span><span class="co">#&gt; $ inclusion : Date[1:6], format: "2023-03-13" "2023-03-01" ...</span></span> <span><span class="co">#&gt; $ inclusion : Date[1:6], format: "2023-03-13" "2023-03-01" ...</span></span>
<span><span class="co">#&gt; $ inclusion_time : 'hms' num [1:6] 12:38:49 10:38:57 12:01:07 20:39:19 ...</span></span> <span><span class="co">#&gt; $ inclusion_time : 'hms' num [1:6] 12:38:49 10:38:57 12:01:07 20:39:19 ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "units")= chr "secs"</span></span> <span><span class="co">#&gt; ..- attr(*, "units")= chr "secs"</span></span>
<span><span class="co">#&gt; $ dob : Date[1:6], format: "1940-03-12" "1934-02-01" ...</span></span> <span><span class="co">#&gt; $ dob : Date[1:6], format: "1940-03-12" "1934-02-01" ...</span></span>
<span><span class="co">#&gt; $ age : num [1:6] 83 89.1 66.1 117.9 126.2 ...</span></span> <span><span class="co">#&gt; $ age : num [1:6] 83 89.1 66.1 117.9 126.2 ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Age\r\nNote: Apparently, the build in datediff() function does not handle counting whole years. This results in"| __truncated__</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Age\r\nNote: Apparently, the build in datediff() function does not handle counting whole years. This results in"| __truncated__</span></span>
<span><span class="co">#&gt; $ age_integer : num [1:6] 83 89 66 117 126 91</span></span> <span><span class="co">#&gt; $ age_integer : num [1:6] 83 89 66 117 126 91</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Age integer\r\nNote: as opposed to the build in datediff() this handles counting years as integers very well. C"| __truncated__</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Age integer\r\nNote: as opposed to the build in datediff() this handles counting years as integers very well. C"| __truncated__</span></span>
<span><span class="co">#&gt; $ sex : chr [1:6] "female" "male" "male" "female" ...</span></span> <span><span class="co">#&gt; $ sex : chr [1:6] "female" "male" "male" "female" ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Legal sex"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Legal sex"</span></span>
<span><span class="co">#&gt; $ cohabitation : 'labelled' chr [1:6] "Yes" "Yes" "No" NA ...</span></span> <span><span class="co">#&gt; $ cohabitation : 'labelled' chr [1:6] "Yes" "Yes" "No" NA ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Cohabitation"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Cohabitation"</span></span>
<span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:2] "1" "2"</span></span> <span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:2] "1" "2"</span></span>
<span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:2] "Yes" "No"</span></span> <span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:2] "Yes" "No"</span></span>
<span><span class="co">#&gt; $ hypertension : 'labelled' chr [1:6] "No" "No" "Yes" NA ...</span></span> <span><span class="co">#&gt; $ hypertension : 'labelled' chr [1:6] "No" "No" "Yes" NA ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Hypertension"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Hypertension"</span></span>
<span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:2] "1" "2"</span></span> <span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:2] "1" "2"</span></span>
<span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:2] "Yes" "No"</span></span> <span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:2] "Yes" "No"</span></span>
<span><span class="co">#&gt; $ diabetes : 'labelled' chr [1:6] "Yes" "No" "Yes" NA ...</span></span> <span><span class="co">#&gt; $ diabetes : 'labelled' chr [1:6] "Yes" "No" "Yes" NA ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Diabetes"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Diabetes"</span></span>
<span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:2] "1" "2"</span></span> <span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:2] "1" "2"</span></span>
<span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:2] "Yes" "No"</span></span> <span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:2] "Yes" "No"</span></span>
<span><span class="co">#&gt; $ region : 'labelled' chr [1:6] "East" "South" "North" NA ...</span></span> <span><span class="co">#&gt; $ region : 'labelled' chr [1:6] "East" "South" "North" NA ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Region"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Region"</span></span>
<span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:4] "1" "2" "3" "4"</span></span> <span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:4] "1" "2" "3" "4"</span></span>
<span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:4] "North" "East" "South" "West"</span></span> <span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:4] "North" "East" "South" "West"</span></span>
<span><span class="co">#&gt; $ baseline_data_start_complete: chr [1:6] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...</span></span> <span><span class="co">#&gt; $ baseline_data_start_complete : chr [1:6] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...</span></span>
<span><span class="co">#&gt; $ mrs_assessed_inclusion : 'labelled' chr [1:6] "Yes" "Yes" NA NA ...</span></span> <span><span class="co">#&gt; $ mrs_assessed____inclusion : 'labelled' chr [1:6] "Yes" "Yes" NA NA ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Assesed"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Assesed"</span></span>
<span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:2] "1" "2"</span></span> <span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:2] "1" "2"</span></span>
<span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:2] "Yes" "No"</span></span> <span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:2] "Yes" "No"</span></span>
<span><span class="co">#&gt; $ mrs_assessed_follow1 : 'labelled' chr [1:6] NA "Yes" "Yes" NA ...</span></span> <span><span class="co">#&gt; $ mrs_assessed____follow1 : 'labelled' chr [1:6] NA "Yes" "Yes" NA ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Assesed"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Assesed"</span></span>
<span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:2] "1" "2"</span></span> <span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:2] "1" "2"</span></span>
<span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:2] "Yes" "No"</span></span> <span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:2] "Yes" "No"</span></span>
<span><span class="co">#&gt; $ mrs_assessed_follow2 : 'labelled' chr [1:6] NA NA "Yes" NA ...</span></span> <span><span class="co">#&gt; $ mrs_assessed____follow2 : 'labelled' chr [1:6] NA NA "Yes" NA ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Assesed"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Assesed"</span></span>
<span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:2] "1" "2"</span></span> <span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:2] "1" "2"</span></span>
<span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:2] "Yes" "No"</span></span> <span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:2] "Yes" "No"</span></span>
<span><span class="co">#&gt; $ mrs_date_inclusion : Date[1:6], format: "2023-03-13" "2023-03-07" ...</span></span> <span><span class="co">#&gt; $ mrs_date____inclusion : Date[1:6], format: "2023-03-13" "2023-03-07" ...</span></span>
<span><span class="co">#&gt; $ mrs_date_follow1 : Date[1:6], format: NA "2023-03-09" ...</span></span> <span><span class="co">#&gt; $ mrs_date____follow1 : Date[1:6], format: NA "2023-03-09" ...</span></span>
<span><span class="co">#&gt; $ mrs_date_follow2 : Date[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ mrs_date____follow2 : Date[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ mrs_score_inclusion : 'labelled' num [1:6] 1 1 NA NA NA NA</span></span> <span><span class="co">#&gt; $ mrs_score____inclusion : 'labelled' num [1:6] 1 1 NA NA NA NA</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "mRS score"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "mRS score"</span></span>
<span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:6] "0" "1" "2" "3" ...</span></span> <span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:6] "0" "1" "2" "3" ...</span></span>
<span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:6] "0" "1" "2" "3" ...</span></span> <span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:6] "0" "1" "2" "3" ...</span></span>
<span><span class="co">#&gt; $ mrs_score_follow1 : 'labelled' num [1:6] NA 3 2 NA NA NA</span></span> <span><span class="co">#&gt; $ mrs_score____follow1 : 'labelled' num [1:6] NA 3 2 NA NA NA</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "mRS score"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "mRS score"</span></span>
<span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:6] "0" "1" "2" "3" ...</span></span> <span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:6] "0" "1" "2" "3" ...</span></span>
<span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:6] "0" "1" "2" "3" ...</span></span> <span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:6] "0" "1" "2" "3" ...</span></span>
<span><span class="co">#&gt; $ mrs_score_follow2 : 'labelled' num [1:6] NA NA 1 NA NA NA</span></span> <span><span class="co">#&gt; $ mrs_score____follow2 : 'labelled' num [1:6] NA NA 1 NA NA NA</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "mRS score"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "mRS score"</span></span>
<span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:6] "0" "1" "2" "3" ...</span></span> <span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:6] "0" "1" "2" "3" ...</span></span>
<span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:6] "0" "1" "2" "3" ...</span></span> <span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:6] "0" "1" "2" "3" ...</span></span>
<span><span class="co">#&gt; $ mrs_complete_inclusion : chr [1:6] "Incomplete" "Incomplete" NA NA ...</span></span> <span><span class="co">#&gt; $ mrs_complete____inclusion : chr [1:6] "Incomplete" "Incomplete" NA NA ...</span></span>
<span><span class="co">#&gt; $ mrs_complete_follow1 : chr [1:6] NA "Incomplete" "Incomplete" NA ...</span></span> <span><span class="co">#&gt; $ mrs_complete____follow1 : chr [1:6] NA "Incomplete" "Incomplete" NA ...</span></span>
<span><span class="co">#&gt; $ mrs_complete_follow2 : chr [1:6] NA NA "Incomplete" NA ...</span></span> <span><span class="co">#&gt; $ mrs_complete____follow2 : chr [1:6] NA NA "Incomplete" NA ...</span></span>
<span><span class="co">#&gt; $ event_datetime_1_follow1 : POSIXct[1:6], format: NA "2024-01-18 12:49:42" ...</span></span> <span><span class="co">#&gt; $ event_datetime____1____follow1 : POSIXct[1:6], format: NA "2024-01-18 12:49:42" ...</span></span>
<span><span class="co">#&gt; $ event_datetime_1_follow2 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime____1____follow2 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_age_1_follow1 : num [1:6] NA NA NA 96 127 NA</span></span> <span><span class="co">#&gt; $ event_age____1____follow1 : num [1:6] NA NA NA 96 127 NA</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Age at event"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Age at event"</span></span>
<span><span class="co">#&gt; $ event_age_1_follow2 : num [1:6] NA NA NA 118 NA NA</span></span> <span><span class="co">#&gt; $ event_age____1____follow2 : num [1:6] NA NA NA 118 NA NA</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Age at event"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Age at event"</span></span>
<span><span class="co">#&gt; $ event_type_1_follow1 : 'labelled' chr [1:6] NA "TIA" "AIS" "TIA" ...</span></span> <span><span class="co">#&gt; $ event_type____1____follow1 : 'labelled' chr [1:6] NA "TIA" "AIS" "TIA" ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Neurovascular event"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Neurovascular event"</span></span>
<span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...</span></span> <span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...</span></span>
<span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...</span></span> <span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...</span></span>
<span><span class="co">#&gt; $ event_type_1_follow2 : 'labelled' chr [1:6] NA NA "ICH" "AIS" ...</span></span> <span><span class="co">#&gt; $ event_type____1____follow2 : 'labelled' chr [1:6] NA NA "ICH" "AIS" ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Neurovascular event"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Neurovascular event"</span></span>
<span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...</span></span> <span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...</span></span>
<span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...</span></span> <span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_1_follow1: chr [1:6] NA "Incomplete" "Incomplete" "Complete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete____1____follow1: chr [1:6] NA "Incomplete" "Incomplete" "Complete" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_1_follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete____1____follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span>
<span><span class="co">#&gt; $ event_datetime_2_follow1 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime____2____follow1 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_datetime_2_follow2 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime____2____follow2 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_datetime_3_follow1 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime____3____follow1 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_datetime_3_follow2 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime____3____follow2 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_age_2_follow1 : num [1:6] NA NA NA 105 127 NA</span></span> <span><span class="co">#&gt; $ event_age____2____follow1 : num [1:6] NA NA NA 105 127 NA</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Age at event"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Age at event"</span></span>
<span><span class="co">#&gt; $ event_age_2_follow2 : num [1:6] NA NA NA 118 NA NA</span></span> <span><span class="co">#&gt; $ event_age____2____follow2 : num [1:6] NA NA NA 118 NA NA</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Age at event"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Age at event"</span></span>
<span><span class="co">#&gt; $ event_age_3_follow1 : num [1:6] NA NA NA NA NA NA</span></span> <span><span class="co">#&gt; $ event_age____3____follow1 : num [1:6] NA NA NA NA NA NA</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Age at event"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Age at event"</span></span>
<span><span class="co">#&gt; $ event_age_3_follow2 : num [1:6] NA NA NA 118 NA NA</span></span> <span><span class="co">#&gt; $ event_age____3____follow2 : num [1:6] NA NA NA 118 NA NA</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Age at event"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Age at event"</span></span>
<span><span class="co">#&gt; $ event_type_2_follow1 : 'labelled' chr [1:6] NA NA "ICH" "TIA" ...</span></span> <span><span class="co">#&gt; $ event_type____2____follow1 : 'labelled' chr [1:6] NA NA "ICH" "TIA" ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Neurovascular event"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Neurovascular event"</span></span>
<span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...</span></span> <span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...</span></span>
<span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...</span></span> <span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...</span></span>
<span><span class="co">#&gt; $ event_type_2_follow2 : 'labelled' chr [1:6] NA NA "TIA" "ICH" ...</span></span> <span><span class="co">#&gt; $ event_type____2____follow2 : 'labelled' chr [1:6] NA NA "TIA" "ICH" ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Neurovascular event"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Neurovascular event"</span></span>
<span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...</span></span> <span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...</span></span>
<span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...</span></span> <span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...</span></span>
<span><span class="co">#&gt; $ event_type_3_follow1 : 'labelled' chr [1:6] NA NA NA NA ...</span></span> <span><span class="co">#&gt; $ event_type____3____follow1 : 'labelled' chr [1:6] NA NA NA NA ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Neurovascular event"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Neurovascular event"</span></span>
<span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...</span></span> <span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...</span></span>
<span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...</span></span> <span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...</span></span>
<span><span class="co">#&gt; $ event_type_3_follow2 : 'labelled' chr [1:6] NA NA "AIS" "Unknown" ...</span></span> <span><span class="co">#&gt; $ event_type____3____follow2 : 'labelled' chr [1:6] NA NA "AIS" "Unknown" ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "label")= chr "Neurovascular event"</span></span> <span><span class="co">#&gt; ..- attr(*, "label")= chr "Neurovascular event"</span></span>
<span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...</span></span> <span><span class="co">#&gt; ..- attr(*, "labels")= Named chr [1:5] "1" "2" "3" "4" ...</span></span>
<span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...</span></span> <span><span class="co">#&gt; .. ..- attr(*, "names")= chr [1:5] "TIA" "AIS" "ICH" "SAH" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_2_follow1: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete____2____follow1: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_2_follow2: chr [1:6] NA NA "Incomplete" "Incomplete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete____2____follow2: chr [1:6] NA NA "Incomplete" "Incomplete" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_3_follow1: chr [1:6] NA NA NA NA ...</span></span> <span><span class="co">#&gt; $ new_event_complete____3____follow1: chr [1:6] NA NA NA NA ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_3_follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span></code></pre></div> <span><span class="co">#&gt; $ new_event_complete____3____follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span></code></pre></div>
<p>Transfer suffixes to labels:</p>
<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">wide_data_suffixes</span> <span class="op">&lt;-</span> <span class="va">wide_data</span> <span class="op">|&gt;</span> <span class="fu"><a href="../reference/suffix2label.html">suffix2label</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
</div> </div>
<div class="section level2"> <div class="section level2">
<h2 id="creating-a-nice-table">Creating a nice table<a class="anchor" aria-label="anchor" href="#creating-a-nice-table"></a> <h2 id="creating-a-nice-table">Creating a nice table<a class="anchor" aria-label="anchor" href="#creating-a-nice-table"></a>
</h2> </h2>
<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb10"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">wide_data</span> <span class="op">|&gt;</span> </span> <code class="sourceCode R"><span><span class="va">wide_data_suffixes</span> <span class="op">|&gt;</span></span>
<span> <span class="fu">dplyr</span><span class="fu">::</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html" class="external-link">select</a></span><span class="op">(</span><span class="va">sex</span>,<span class="va">hypertension</span>, <span class="va">diabetes</span><span class="op">)</span> <span class="op">|&gt;</span> </span> <span> <span class="fu">dplyr</span><span class="fu">::</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html" class="external-link">select</a></span><span class="op">(</span><span class="va">sex</span>, <span class="va">hypertension</span>, <span class="va">diabetes</span>,<span class="va">mrs_score____follow2</span><span class="op">)</span> <span class="op">|&gt;</span></span>
<span> <span class="fu">gtsummary</span><span class="fu">::</span><span class="fu"><a href="https://www.danieldsjoberg.com/gtsummary/reference/tbl_summary.html" class="external-link">tbl_summary</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div> <span> <span class="fu">gtsummary</span><span class="fu">::</span><span class="fu"><a href="https://www.danieldsjoberg.com/gtsummary/reference/tbl_summary.html" class="external-link">tbl_summary</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
<div id="ulbfdpbcyv" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;"> <div id="ulbfdpbcyv" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>#ulbfdpbcyv table { <style>#ulbfdpbcyv table {
@ -2938,6 +2948,18 @@ format):</p>
<td headers="label" class="gt_row gt_left">    Unknown</td> <td headers="label" class="gt_row gt_left">    Unknown</td>
<td headers="stat_0" class="gt_row gt_center">1</td> <td headers="stat_0" class="gt_row gt_center">1</td>
</tr> </tr>
<tr>
<td headers="label" class="gt_row gt_left">mRS score (follow2)</td>
<td headers="stat_0" class="gt_row gt_center"><br></td>
</tr>
<tr>
<td headers="label" class="gt_row gt_left">    1</td>
<td headers="stat_0" class="gt_row gt_center">1 (100%)</td>
</tr>
<tr>
<td headers="label" class="gt_row gt_left">    Unknown</td>
<td headers="stat_0" class="gt_row gt_center">5</td>
</tr>
</tbody> </tbody>
<tfoot class="gt_footnotes"><tr> <tfoot class="gt_footnotes"><tr>
<td class="gt_footnote" colspan="2"> <td class="gt_footnote" colspan="2">

View File

@ -93,56 +93,56 @@ and launch the app as follows:</p>
<span><span class="co">#&gt; Joining with `by = join_by(record_id)`</span></span> <span><span class="co">#&gt; Joining with `by = join_by(record_id)`</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/str.html" class="external-link">str</a></span><span class="op">(</span><span class="va">ds</span><span class="op">)</span></span> <span><span class="fu"><a href="https://rdrr.io/r/utils/str.html" class="external-link">str</a></span><span class="op">(</span><span class="va">ds</span><span class="op">)</span></span>
<span><span class="co">#&gt; tibble [6 × 49] (S3: tbl_df/tbl/data.frame)</span></span> <span><span class="co">#&gt; tibble [6 × 49] (S3: tbl_df/tbl/data.frame)</span></span>
<span><span class="co">#&gt; $ record_id : num [1:6] 1 2 3 4 5 6</span></span> <span><span class="co">#&gt; $ record_id : num [1:6] 1 2 3 4 5 6</span></span>
<span><span class="co">#&gt; $ cpr : chr [1:6] "1203401OB4" "0102342303" "2301569823" "0204051342" ...</span></span> <span><span class="co">#&gt; $ cpr : chr [1:6] "1203401OB4" "0102342303" "2301569823" "0204051342" ...</span></span>
<span><span class="co">#&gt; $ inclusion : Date[1:6], format: "2023-03-13" "2023-03-01" ...</span></span> <span><span class="co">#&gt; $ inclusion : Date[1:6], format: "2023-03-13" "2023-03-01" ...</span></span>
<span><span class="co">#&gt; $ inclusion_time : 'hms' num [1:6] 12:38:49 10:38:57 12:01:07 20:39:19 ...</span></span> <span><span class="co">#&gt; $ inclusion_time : 'hms' num [1:6] 12:38:49 10:38:57 12:01:07 20:39:19 ...</span></span>
<span><span class="co">#&gt; ..- attr(*, "units")= chr "secs"</span></span> <span><span class="co">#&gt; ..- attr(*, "units")= chr "secs"</span></span>
<span><span class="co">#&gt; $ dob : Date[1:6], format: "1940-03-12" "1934-02-01" ...</span></span> <span><span class="co">#&gt; $ dob : Date[1:6], format: "1940-03-12" "1934-02-01" ...</span></span>
<span><span class="co">#&gt; $ age : num [1:6] 83 89.1 66.1 117.9 126.2 ...</span></span> <span><span class="co">#&gt; $ age : num [1:6] 83 89.1 66.1 117.9 126.2 ...</span></span>
<span><span class="co">#&gt; $ age_integer : num [1:6] 83 89 66 117 126 91</span></span> <span><span class="co">#&gt; $ age_integer : num [1:6] 83 89 66 117 126 91</span></span>
<span><span class="co">#&gt; $ sex : chr [1:6] "female" "male" "male" "female" ...</span></span> <span><span class="co">#&gt; $ sex : chr [1:6] "female" "male" "male" "female" ...</span></span>
<span><span class="co">#&gt; $ cohabitation : chr [1:6] "Yes" "Yes" "No" NA ...</span></span> <span><span class="co">#&gt; $ cohabitation : chr [1:6] "Yes" "Yes" "No" NA ...</span></span>
<span><span class="co">#&gt; $ hypertension : chr [1:6] "No" "No" "Yes" NA ...</span></span> <span><span class="co">#&gt; $ hypertension : chr [1:6] "No" "No" "Yes" NA ...</span></span>
<span><span class="co">#&gt; $ diabetes : chr [1:6] "Yes" "No" "Yes" NA ...</span></span> <span><span class="co">#&gt; $ diabetes : chr [1:6] "Yes" "No" "Yes" NA ...</span></span>
<span><span class="co">#&gt; $ region : chr [1:6] "East" "South" "North" NA ...</span></span> <span><span class="co">#&gt; $ region : chr [1:6] "East" "South" "North" NA ...</span></span>
<span><span class="co">#&gt; $ baseline_data_start_complete: chr [1:6] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...</span></span> <span><span class="co">#&gt; $ baseline_data_start_complete : chr [1:6] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...</span></span>
<span><span class="co">#&gt; $ mrs_assessed_inclusion : chr [1:6] "Yes" "Yes" NA NA ...</span></span> <span><span class="co">#&gt; $ mrs_assessed____inclusion : chr [1:6] "Yes" "Yes" NA NA ...</span></span>
<span><span class="co">#&gt; $ mrs_assessed_follow1 : chr [1:6] NA "Yes" "Yes" NA ...</span></span> <span><span class="co">#&gt; $ mrs_assessed____follow1 : chr [1:6] NA "Yes" "Yes" NA ...</span></span>
<span><span class="co">#&gt; $ mrs_assessed_follow2 : chr [1:6] NA NA "Yes" NA ...</span></span> <span><span class="co">#&gt; $ mrs_assessed____follow2 : chr [1:6] NA NA "Yes" NA ...</span></span>
<span><span class="co">#&gt; $ mrs_date_inclusion : Date[1:6], format: "2023-03-13" "2023-03-07" ...</span></span> <span><span class="co">#&gt; $ mrs_date____inclusion : Date[1:6], format: "2023-03-13" "2023-03-07" ...</span></span>
<span><span class="co">#&gt; $ mrs_date_follow1 : Date[1:6], format: NA "2023-03-09" ...</span></span> <span><span class="co">#&gt; $ mrs_date____follow1 : Date[1:6], format: NA "2023-03-09" ...</span></span>
<span><span class="co">#&gt; $ mrs_date_follow2 : Date[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ mrs_date____follow2 : Date[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ mrs_score_inclusion : num [1:6] 1 1 NA NA NA NA</span></span> <span><span class="co">#&gt; $ mrs_score____inclusion : num [1:6] 1 1 NA NA NA NA</span></span>
<span><span class="co">#&gt; $ mrs_score_follow1 : num [1:6] NA 3 2 NA NA NA</span></span> <span><span class="co">#&gt; $ mrs_score____follow1 : num [1:6] NA 3 2 NA NA NA</span></span>
<span><span class="co">#&gt; $ mrs_score_follow2 : num [1:6] NA NA 1 NA NA NA</span></span> <span><span class="co">#&gt; $ mrs_score____follow2 : num [1:6] NA NA 1 NA NA NA</span></span>
<span><span class="co">#&gt; $ mrs_complete_inclusion : chr [1:6] "Incomplete" "Incomplete" NA NA ...</span></span> <span><span class="co">#&gt; $ mrs_complete____inclusion : chr [1:6] "Incomplete" "Incomplete" NA NA ...</span></span>
<span><span class="co">#&gt; $ mrs_complete_follow1 : chr [1:6] NA "Incomplete" "Incomplete" NA ...</span></span> <span><span class="co">#&gt; $ mrs_complete____follow1 : chr [1:6] NA "Incomplete" "Incomplete" NA ...</span></span>
<span><span class="co">#&gt; $ mrs_complete_follow2 : chr [1:6] NA NA "Incomplete" NA ...</span></span> <span><span class="co">#&gt; $ mrs_complete____follow2 : chr [1:6] NA NA "Incomplete" NA ...</span></span>
<span><span class="co">#&gt; $ event_datetime_1_follow1 : POSIXct[1:6], format: NA "2024-01-18 12:49:42" ...</span></span> <span><span class="co">#&gt; $ event_datetime____1____follow1 : POSIXct[1:6], format: NA "2024-01-18 12:49:42" ...</span></span>
<span><span class="co">#&gt; $ event_datetime_1_follow2 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime____1____follow2 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_age_1_follow1 : num [1:6] NA NA NA 96 127 NA</span></span> <span><span class="co">#&gt; $ event_age____1____follow1 : num [1:6] NA NA NA 96 127 NA</span></span>
<span><span class="co">#&gt; $ event_age_1_follow2 : num [1:6] NA NA NA 118 NA NA</span></span> <span><span class="co">#&gt; $ event_age____1____follow2 : num [1:6] NA NA NA 118 NA NA</span></span>
<span><span class="co">#&gt; $ event_type_1_follow1 : chr [1:6] NA "TIA" "AIS" "TIA" ...</span></span> <span><span class="co">#&gt; $ event_type____1____follow1 : chr [1:6] NA "TIA" "AIS" "TIA" ...</span></span>
<span><span class="co">#&gt; $ event_type_1_follow2 : chr [1:6] NA NA "ICH" "AIS" ...</span></span> <span><span class="co">#&gt; $ event_type____1____follow2 : chr [1:6] NA NA "ICH" "AIS" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_1_follow1: chr [1:6] NA "Incomplete" "Incomplete" "Complete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete____1____follow1: chr [1:6] NA "Incomplete" "Incomplete" "Complete" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_1_follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete____1____follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span>
<span><span class="co">#&gt; $ event_datetime_2_follow1 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime____2____follow1 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_datetime_2_follow2 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime____2____follow2 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_datetime_3_follow1 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime____3____follow1 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_datetime_3_follow2 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime____3____follow2 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_age_2_follow1 : num [1:6] NA NA NA 105 127 NA</span></span> <span><span class="co">#&gt; $ event_age____2____follow1 : num [1:6] NA NA NA 105 127 NA</span></span>
<span><span class="co">#&gt; $ event_age_2_follow2 : num [1:6] NA NA NA 118 NA NA</span></span> <span><span class="co">#&gt; $ event_age____2____follow2 : num [1:6] NA NA NA 118 NA NA</span></span>
<span><span class="co">#&gt; $ event_age_3_follow1 : num [1:6] NA NA NA NA NA NA</span></span> <span><span class="co">#&gt; $ event_age____3____follow1 : num [1:6] NA NA NA NA NA NA</span></span>
<span><span class="co">#&gt; $ event_age_3_follow2 : num [1:6] NA NA NA 118 NA NA</span></span> <span><span class="co">#&gt; $ event_age____3____follow2 : num [1:6] NA NA NA 118 NA NA</span></span>
<span><span class="co">#&gt; $ event_type_2_follow1 : chr [1:6] NA NA "ICH" "TIA" ...</span></span> <span><span class="co">#&gt; $ event_type____2____follow1 : chr [1:6] NA NA "ICH" "TIA" ...</span></span>
<span><span class="co">#&gt; $ event_type_2_follow2 : chr [1:6] NA NA "TIA" "ICH" ...</span></span> <span><span class="co">#&gt; $ event_type____2____follow2 : chr [1:6] NA NA "TIA" "ICH" ...</span></span>
<span><span class="co">#&gt; $ event_type_3_follow1 : chr [1:6] NA NA NA NA ...</span></span> <span><span class="co">#&gt; $ event_type____3____follow1 : chr [1:6] NA NA NA NA ...</span></span>
<span><span class="co">#&gt; $ event_type_3_follow2 : chr [1:6] NA NA "AIS" "Unknown" ...</span></span> <span><span class="co">#&gt; $ event_type____3____follow2 : chr [1:6] NA NA "AIS" "Unknown" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_2_follow1: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete____2____follow1: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_2_follow2: chr [1:6] NA NA "Incomplete" "Incomplete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete____2____follow2: chr [1:6] NA NA "Incomplete" "Incomplete" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_3_follow1: chr [1:6] NA NA NA NA ...</span></span> <span><span class="co">#&gt; $ new_event_complete____3____follow1: chr [1:6] NA NA NA NA ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_3_follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete____3____follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span>
<span><span class="co">#&gt; - attr(*, "problems")=&lt;externalptr&gt;</span></span></code></pre></div> <span><span class="co">#&gt; - attr(*, "problems")=&lt;externalptr&gt;</span></span></code></pre></div>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">ds</span><span class="op">|&gt;</span> </span> <code class="sourceCode R"><span><span class="va">ds</span><span class="op">|&gt;</span> </span>
@ -150,55 +150,55 @@ and launch the app as follows:</p>
<span> <span class="fu">purrr</span><span class="fu">::</span><span class="fu"><a href="https://purrr.tidyverse.org/reference/pluck.html" class="external-link">pluck</a></span><span class="op">(</span><span class="st">"data"</span><span class="op">)</span> <span class="op">|&gt;</span> </span> <span> <span class="fu">purrr</span><span class="fu">::</span><span class="fu"><a href="https://purrr.tidyverse.org/reference/pluck.html" class="external-link">pluck</a></span><span class="op">(</span><span class="st">"data"</span><span class="op">)</span> <span class="op">|&gt;</span> </span>
<span> <span class="fu"><a href="https://rdrr.io/r/utils/str.html" class="external-link">str</a></span><span class="op">(</span><span class="op">)</span></span> <span> <span class="fu"><a href="https://rdrr.io/r/utils/str.html" class="external-link">str</a></span><span class="op">(</span><span class="op">)</span></span>
<span><span class="co">#&gt; tibble [6 × 49] (S3: tbl_df/tbl/data.frame)</span></span> <span><span class="co">#&gt; tibble [6 × 49] (S3: tbl_df/tbl/data.frame)</span></span>
<span><span class="co">#&gt; $ record_id : num [1:6] 1 2 3 4 5 6</span></span> <span><span class="co">#&gt; $ record_id : num [1:6] 1 2 3 4 5 6</span></span>
<span><span class="co">#&gt; $ cpr : chr [1:6] "1203401OB4" "0102342303" "2301569823" "0204051342" ...</span></span> <span><span class="co">#&gt; $ cpr : chr [1:6] "1203401OB4" "0102342303" "2301569823" "0204051342" ...</span></span>
<span><span class="co">#&gt; $ inclusion : Date[1:6], format: "2023-03-13" "2023-03-01" ...</span></span> <span><span class="co">#&gt; $ inclusion : Date[1:6], format: "2023-03-13" "2023-03-01" ...</span></span>
<span><span class="co">#&gt; $ inclusion_time : chr [1:6] "12:38:49" "10:38:57" "12:01:07" "20:39:19" ...</span></span> <span><span class="co">#&gt; $ inclusion_time : chr [1:6] "12:38:49" "10:38:57" "12:01:07" "20:39:19" ...</span></span>
<span><span class="co">#&gt; $ dob : Date[1:6], format: "1940-03-12" "1934-02-01" ...</span></span> <span><span class="co">#&gt; $ dob : Date[1:6], format: "1940-03-12" "1934-02-01" ...</span></span>
<span><span class="co">#&gt; $ age : num [1:6] 83 89.1 66.1 117.9 126.2 ...</span></span> <span><span class="co">#&gt; $ age : num [1:6] 83 89.1 66.1 117.9 126.2 ...</span></span>
<span><span class="co">#&gt; $ age_integer : num [1:6] 83 89 66 117 126 91</span></span> <span><span class="co">#&gt; $ age_integer : num [1:6] 83 89 66 117 126 91</span></span>
<span><span class="co">#&gt; $ sex : chr [1:6] "female" "male" "male" "female" ...</span></span> <span><span class="co">#&gt; $ sex : chr [1:6] "female" "male" "male" "female" ...</span></span>
<span><span class="co">#&gt; $ cohabitation : chr [1:6] "Yes" "Yes" "No" NA ...</span></span> <span><span class="co">#&gt; $ cohabitation : chr [1:6] "Yes" "Yes" "No" NA ...</span></span>
<span><span class="co">#&gt; $ hypertension : chr [1:6] "No" "No" "Yes" NA ...</span></span> <span><span class="co">#&gt; $ hypertension : chr [1:6] "No" "No" "Yes" NA ...</span></span>
<span><span class="co">#&gt; $ diabetes : chr [1:6] "Yes" "No" "Yes" NA ...</span></span> <span><span class="co">#&gt; $ diabetes : chr [1:6] "Yes" "No" "Yes" NA ...</span></span>
<span><span class="co">#&gt; $ region : chr [1:6] "East" "South" "North" NA ...</span></span> <span><span class="co">#&gt; $ region : chr [1:6] "East" "South" "North" NA ...</span></span>
<span><span class="co">#&gt; $ baseline_data_start_complete: chr [1:6] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...</span></span> <span><span class="co">#&gt; $ baseline_data_start_complete : chr [1:6] "Incomplete" "Incomplete" "Incomplete" "Incomplete" ...</span></span>
<span><span class="co">#&gt; $ mrs_assessed_inclusion : chr [1:6] "Yes" "Yes" NA NA ...</span></span> <span><span class="co">#&gt; $ mrs_assessed____inclusion : chr [1:6] "Yes" "Yes" NA NA ...</span></span>
<span><span class="co">#&gt; $ mrs_assessed_follow1 : chr [1:6] NA "Yes" "Yes" NA ...</span></span> <span><span class="co">#&gt; $ mrs_assessed____follow1 : chr [1:6] NA "Yes" "Yes" NA ...</span></span>
<span><span class="co">#&gt; $ mrs_assessed_follow2 : chr [1:6] NA NA "Yes" NA ...</span></span> <span><span class="co">#&gt; $ mrs_assessed____follow2 : chr [1:6] NA NA "Yes" NA ...</span></span>
<span><span class="co">#&gt; $ mrs_date_inclusion : Date[1:6], format: "2023-03-13" "2023-03-07" ...</span></span> <span><span class="co">#&gt; $ mrs_date____inclusion : Date[1:6], format: "2023-03-13" "2023-03-07" ...</span></span>
<span><span class="co">#&gt; $ mrs_date_follow1 : Date[1:6], format: NA "2023-03-09" ...</span></span> <span><span class="co">#&gt; $ mrs_date____follow1 : Date[1:6], format: NA "2023-03-09" ...</span></span>
<span><span class="co">#&gt; $ mrs_date_follow2 : Date[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ mrs_date____follow2 : Date[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ mrs_score_inclusion : num [1:6] 1 1 NA NA NA NA</span></span> <span><span class="co">#&gt; $ mrs_score____inclusion : num [1:6] 1 1 NA NA NA NA</span></span>
<span><span class="co">#&gt; $ mrs_score_follow1 : num [1:6] NA 3 2 NA NA NA</span></span> <span><span class="co">#&gt; $ mrs_score____follow1 : num [1:6] NA 3 2 NA NA NA</span></span>
<span><span class="co">#&gt; $ mrs_score_follow2 : num [1:6] NA NA 1 NA NA NA</span></span> <span><span class="co">#&gt; $ mrs_score____follow2 : num [1:6] NA NA 1 NA NA NA</span></span>
<span><span class="co">#&gt; $ mrs_complete_inclusion : chr [1:6] "Incomplete" "Incomplete" NA NA ...</span></span> <span><span class="co">#&gt; $ mrs_complete____inclusion : chr [1:6] "Incomplete" "Incomplete" NA NA ...</span></span>
<span><span class="co">#&gt; $ mrs_complete_follow1 : chr [1:6] NA "Incomplete" "Incomplete" NA ...</span></span> <span><span class="co">#&gt; $ mrs_complete____follow1 : chr [1:6] NA "Incomplete" "Incomplete" NA ...</span></span>
<span><span class="co">#&gt; $ mrs_complete_follow2 : chr [1:6] NA NA "Incomplete" NA ...</span></span> <span><span class="co">#&gt; $ mrs_complete____follow2 : chr [1:6] NA NA "Incomplete" NA ...</span></span>
<span><span class="co">#&gt; $ event_datetime_1_follow1 : POSIXct[1:6], format: NA "2024-01-18 12:49:42" ...</span></span> <span><span class="co">#&gt; $ event_datetime____1____follow1 : POSIXct[1:6], format: NA "2024-01-18 12:49:42" ...</span></span>
<span><span class="co">#&gt; $ event_datetime_1_follow2 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime____1____follow2 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_age_1_follow1 : num [1:6] NA NA NA 96 127 NA</span></span> <span><span class="co">#&gt; $ event_age____1____follow1 : num [1:6] NA NA NA 96 127 NA</span></span>
<span><span class="co">#&gt; $ event_age_1_follow2 : num [1:6] NA NA NA 118 NA NA</span></span> <span><span class="co">#&gt; $ event_age____1____follow2 : num [1:6] NA NA NA 118 NA NA</span></span>
<span><span class="co">#&gt; $ event_type_1_follow1 : chr [1:6] NA "TIA" "AIS" "TIA" ...</span></span> <span><span class="co">#&gt; $ event_type____1____follow1 : chr [1:6] NA "TIA" "AIS" "TIA" ...</span></span>
<span><span class="co">#&gt; $ event_type_1_follow2 : chr [1:6] NA NA "ICH" "AIS" ...</span></span> <span><span class="co">#&gt; $ event_type____1____follow2 : chr [1:6] NA NA "ICH" "AIS" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_1_follow1: chr [1:6] NA "Incomplete" "Incomplete" "Complete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete____1____follow1: chr [1:6] NA "Incomplete" "Incomplete" "Complete" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_1_follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete____1____follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span>
<span><span class="co">#&gt; $ event_datetime_2_follow1 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime____2____follow1 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_datetime_2_follow2 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime____2____follow2 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_datetime_3_follow1 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime____3____follow1 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_datetime_3_follow2 : POSIXct[1:6], format: NA NA ...</span></span> <span><span class="co">#&gt; $ event_datetime____3____follow2 : POSIXct[1:6], format: NA NA ...</span></span>
<span><span class="co">#&gt; $ event_age_2_follow1 : num [1:6] NA NA NA 105 127 NA</span></span> <span><span class="co">#&gt; $ event_age____2____follow1 : num [1:6] NA NA NA 105 127 NA</span></span>
<span><span class="co">#&gt; $ event_age_2_follow2 : num [1:6] NA NA NA 118 NA NA</span></span> <span><span class="co">#&gt; $ event_age____2____follow2 : num [1:6] NA NA NA 118 NA NA</span></span>
<span><span class="co">#&gt; $ event_age_3_follow1 : num [1:6] NA NA NA NA NA NA</span></span> <span><span class="co">#&gt; $ event_age____3____follow1 : num [1:6] NA NA NA NA NA NA</span></span>
<span><span class="co">#&gt; $ event_age_3_follow2 : num [1:6] NA NA NA 118 NA NA</span></span> <span><span class="co">#&gt; $ event_age____3____follow2 : num [1:6] NA NA NA 118 NA NA</span></span>
<span><span class="co">#&gt; $ event_type_2_follow1 : chr [1:6] NA NA "ICH" "TIA" ...</span></span> <span><span class="co">#&gt; $ event_type____2____follow1 : chr [1:6] NA NA "ICH" "TIA" ...</span></span>
<span><span class="co">#&gt; $ event_type_2_follow2 : chr [1:6] NA NA "TIA" "ICH" ...</span></span> <span><span class="co">#&gt; $ event_type____2____follow2 : chr [1:6] NA NA "TIA" "ICH" ...</span></span>
<span><span class="co">#&gt; $ event_type_3_follow1 : chr [1:6] NA NA NA NA ...</span></span> <span><span class="co">#&gt; $ event_type____3____follow1 : chr [1:6] NA NA NA NA ...</span></span>
<span><span class="co">#&gt; $ event_type_3_follow2 : chr [1:6] NA NA "AIS" "Unknown" ...</span></span> <span><span class="co">#&gt; $ event_type____3____follow2 : chr [1:6] NA NA "AIS" "Unknown" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_2_follow1: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete____2____follow1: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_2_follow2: chr [1:6] NA NA "Incomplete" "Incomplete" ...</span></span> <span><span class="co">#&gt; $ new_event_complete____2____follow2: chr [1:6] NA NA "Incomplete" "Incomplete" ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_3_follow1: chr [1:6] NA NA NA NA ...</span></span> <span><span class="co">#&gt; $ new_event_complete____3____follow1: chr [1:6] NA NA NA NA ...</span></span>
<span><span class="co">#&gt; $ new_event_complete_3_follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span></code></pre></div> <span><span class="co">#&gt; $ new_event_complete____3____follow2: chr [1:6] NA NA "Incomplete" "Complete" ...</span></span></code></pre></div>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">ds</span><span class="op">|&gt;</span> </span> <code class="sourceCode R"><span><span class="va">ds</span><span class="op">|&gt;</span> </span>
<span> <span class="fu"><a href="../reference/ds2dd_detailed.html">ds2dd_detailed</a></span><span class="op">(</span>metadata <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="fu">REDCapCAST</span><span class="fu">::</span><span class="va"><a href="../reference/redcapcast_meta.html">redcapcast_meta</a></span><span class="op">)</span><span class="op">)</span><span class="op">|&gt;</span> </span> <span> <span class="fu"><a href="../reference/ds2dd_detailed.html">ds2dd_detailed</a></span><span class="op">(</span>metadata <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="fu">REDCapCAST</span><span class="fu">::</span><span class="va"><a href="../reference/redcapcast_meta.html">redcapcast_meta</a></span><span class="op">)</span><span class="op">)</span><span class="op">|&gt;</span> </span>

View File

@ -5,7 +5,7 @@ articles:
Database-creation: Database-creation.html Database-creation: Database-creation.html
REDCapCAST: REDCapCAST.html REDCapCAST: REDCapCAST.html
Shiny-app: Shiny-app.html Shiny-app: Shiny-app.html
last_built: 2024-11-28T13:54Z last_built: 2024-11-28T20:10Z
urls: urls:
reference: https://agdamsbo.github.io/REDCapCAST/reference reference: https://agdamsbo.github.io/REDCapCAST/reference
article: https://agdamsbo.github.io/REDCapCAST/articles article: https://agdamsbo.github.io/REDCapCAST/articles

View File

@ -433,6 +433,12 @@
<dd>Extended string splitting</dd> <dd>Extended string splitting</dd>
</dl><dl><dt> </dl><dl><dt>
<code><a href="suffix2label.html">suffix2label()</a></code>
</dt>
<dd>Transfer variable name suffix to label in widened data</dd>
</dl><dl><dt>
<code><a href="time_only_correction.html">time_only_correction()</a></code> <code><a href="time_only_correction.html">time_only_correction()</a></code>
</dt> </dt>

View File

@ -55,8 +55,8 @@ split by <a href="REDCap_split.html">REDCap_split</a>.</p>
<h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2> <h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">redcap_wider</span><span class="op">(</span></span> <div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">redcap_wider</span><span class="op">(</span></span>
<span> <span class="va">data</span>,</span> <span> <span class="va">data</span>,</span>
<span> event.glue <span class="op">=</span> <span class="st">"{.value}_{redcap_event_name}"</span>,</span> <span> event.glue <span class="op">=</span> <span class="st">"{.value}____{redcap_event_name}"</span>,</span>
<span> inst.glue <span class="op">=</span> <span class="st">"{.value}_{redcap_repeat_instance}"</span></span> <span> inst.glue <span class="op">=</span> <span class="st">"{.value}____{redcap_repeat_instance}"</span></span>
<span><span class="op">)</span></span></code></pre></div> <span><span class="op">)</span></span></code></pre></div>
</div> </div>
@ -99,10 +99,10 @@ split by <a href="REDCap_split.html">REDCap_split</a>.</p>
<span class="r-in"><span><span class="fu">redcap_wider</span><span class="op">(</span><span class="va">list1</span><span class="op">)</span></span></span> <span class="r-in"><span><span class="fu">redcap_wider</span><span class="op">(</span><span class="va">list1</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Joining with `by = join_by(record_id)`</span> <span class="r-msg co"><span class="r-pr">#&gt;</span> Joining with `by = join_by(record_id)`</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 2 × 4</span></span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 2 × 4</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> record_id age_baseline age_followup gender</span> <span class="r-out co"><span class="r-pr">#&gt;</span> record_id age____baseline age____followup gender</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> 1 25 27 male </span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> 1 25 27 male </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> 2 26 28 female</span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> 2 26 28 female</span>
<span class="r-in"><span><span class="co"># Simpel with two instruments</span></span></span> <span class="r-in"><span><span class="co"># Simpel with two instruments</span></span></span>
<span class="r-in"><span><span class="va">list2</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span></span></span> <span class="r-in"><span><span class="va">list2</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span></span></span> <span class="r-in"><span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span></span></span>
@ -155,12 +155,12 @@ split by <a href="REDCap_split.html">REDCap_split</a>.</p>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Joining with `by = join_by(record_id)`</span> <span class="r-msg co"><span class="r-pr">#&gt;</span> Joining with `by = join_by(record_id)`</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Joining with `by = join_by(record_id)`</span> <span class="r-msg co"><span class="r-pr">#&gt;</span> Joining with `by = join_by(record_id)`</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 2 × 8</span></span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 2 × 8</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> record_id age_baseline age_followup dist_1_baseline dist_1_followup</span> <span class="r-out co"><span class="r-pr">#&gt;</span> record_id age____baseline age____followup dist____1____baseline</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span></span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> 1 25 27 40 25</span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> 1 25 27 40</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> 2 26 28 28 23</span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> 2 26 28 28</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 3 more variables: dist_2_baseline &lt;dbl&gt;, dist_2_followup &lt;dbl&gt;,</span></span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 4 more variables: dist____1____followup &lt;dbl&gt;, dist____2____baseline &lt;dbl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># gender &lt;chr&gt;</span></span> <span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># dist____2____followup &lt;dbl&gt;, gender &lt;chr&gt;</span></span>
</code></pre></div> </code></pre></div>
</div> </div>
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2> </main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>

100
reference/suffix2label.html Normal file
View File

@ -0,0 +1,100 @@
<!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>Transfer variable name suffix to label in widened data — suffix2label • 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="Transfer variable name suffix to label in widened data — suffix2label"><meta name="description" content="Transfer variable name suffix to label in widened data"><meta property="og:description" content="Transfer variable name suffix to label in widened data"><meta property="og:image" content="https://agdamsbo.github.io/REDCapCAST/logo.png"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
<nav class="navbar navbar-expand-lg fixed-top bg-light" data-bs-theme="light" aria-label="Site navigation"><div class="container">
<a class="navbar-brand me-2" href="../index.html">REDCapCAST</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">24.11.4</small>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar" class="collapse navbar-collapse ms-3">
<ul class="navbar-nav me-auto"><li class="nav-item"><a class="nav-link" href="../articles/REDCapCAST.html">Get started</a></li>
<li class="active nav-item"><a class="nav-link" href="../reference/index.html">Reference</a></li>
<li class="nav-item dropdown">
<button class="nav-link dropdown-toggle" type="button" id="dropdown-articles" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true">Articles</button>
<ul class="dropdown-menu" aria-labelledby="dropdown-articles"><li><a class="dropdown-item" href="../articles/Database-creation.html">Database-creation</a></li>
<li><a class="dropdown-item" href="../articles/Shiny-app.html">Shiny-app</a></li>
</ul></li>
<li class="nav-item"><a class="nav-link" href="../news/index.html">Changelog</a></li>
</ul><ul class="navbar-nav"><li class="nav-item"><form class="form-inline" role="search">
<input class="form-control" type="search" name="search-input" id="search-input" autocomplete="off" aria-label="Search site" placeholder="Search for" data-search-index="../search.json"></form></li>
<li class="nav-item"><a class="external-link nav-link" href="https://github.com/agdamsbo/REDCapCAST/" aria-label="GitHub"><span class="fa fab fa-github fa-lg"></span></a></li>
</ul></div>
</div>
</nav><div class="container template-reference-topic">
<div class="row">
<main id="main" class="col-md-9"><div class="page-header">
<img src="../logo.png" class="logo" alt=""><h1>Transfer variable name suffix to label in widened data</h1>
<small class="dont-index">Source: <a href="https://github.com/agdamsbo/REDCapCAST/blob/main/R/redcap_wider.R" class="external-link"><code>R/redcap_wider.R</code></a></small>
<div class="d-none name"><code>suffix2label.Rd</code></div>
</div>
<div class="ref-description section level2">
<p>Transfer variable name suffix to label in widened data</p>
</div>
<div class="section level2">
<h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">suffix2label</span><span class="op">(</span></span>
<span> <span class="va">data</span>,</span>
<span> suffix.sep <span class="op">=</span> <span class="st">"____"</span>,</span>
<span> attr <span class="op">=</span> <span class="st">"label"</span>,</span>
<span> glue.str <span class="op">=</span> <span class="st">"{label} ({paste(suffixes,collapse=', ')})"</span></span>
<span><span class="op">)</span></span></code></pre></div>
</div>
<div class="section level2">
<h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a></h2>
<dl><dt id="arg-data">data<a class="anchor" aria-label="anchor" href="#arg-data"></a></dt>
<dd><p>data.frame</p></dd>
<dt id="arg-suffix-sep">suffix.sep<a class="anchor" aria-label="anchor" href="#arg-suffix-sep"></a></dt>
<dd><p>string to split suffix(es). Passed to <a href="https://rdrr.io/r/base/strsplit.html" class="external-link">strsplit</a></p></dd>
<dt id="arg-attr">attr<a class="anchor" aria-label="anchor" href="#arg-attr"></a></dt>
<dd><p>label attribute. Default is "label"</p></dd>
<dt id="arg-glue-str">glue.str<a class="anchor" aria-label="anchor" href="#arg-glue-str"></a></dt>
<dd><p>glue string for new label. Available variables are "label"
and "suffixes"</p></dd>
</dl></div>
<div class="section level2">
<h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
<p>data.frame</p>
</div>
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
</nav></aside></div>
<footer><div class="pkgdown-footer-left">
<p>Developed by Andreas Gammelgaard Damsbo, Paul Egeler.</p>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.1.</p>
</div>
</footer></div>
</body></html>

File diff suppressed because one or more lines are too long

View File

@ -75,6 +75,7 @@
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/shiny_cast.html</loc></url> <url><loc>https://agdamsbo.github.io/REDCapCAST/reference/shiny_cast.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/split_non_repeating_forms.html</loc></url> <url><loc>https://agdamsbo.github.io/REDCapCAST/reference/split_non_repeating_forms.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/strsplitx.html</loc></url> <url><loc>https://agdamsbo.github.io/REDCapCAST/reference/strsplitx.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/suffix2label.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/time_only_correction.html</loc></url> <url><loc>https://agdamsbo.github.io/REDCapCAST/reference/time_only_correction.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/var2fct.html</loc></url> <url><loc>https://agdamsbo.github.io/REDCapCAST/reference/var2fct.html</loc></url>
<url><loc>https://agdamsbo.github.io/REDCapCAST/reference/vec2choice.html</loc></url> <url><loc>https://agdamsbo.github.io/REDCapCAST/reference/vec2choice.html</loc></url>