diff --git a/articles/toolbox.html b/articles/toolbox.html
index 3a9414a..6dd51f3 100644
--- a/articles/toolbox.html
+++ b/articles/toolbox.html
@@ -223,23 +223,23 @@ model plot (with stRoke::ci_plot()
variables = c ( "hypertension" , "diabetes" , "civil" ) )
#> Waiting for profiling to be done...
#> $`Table 1`
-#> <div id="bdpixpkpcq" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
-#> <style>#bdpixpkpcq table {
+#> <div id="btkxezdvhk" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
+#> <style>#btkxezdvhk table {
#> font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
#> -webkit-font-smoothing: antialiased;
#> -moz-osx-font-smoothing: grayscale;
#> }
#>
-#> #bdpixpkpcq thead, #bdpixpkpcq tbody, #bdpixpkpcq tfoot, #bdpixpkpcq tr, #bdpixpkpcq td, #bdpixpkpcq th {
+#> #btkxezdvhk thead, #btkxezdvhk tbody, #btkxezdvhk tfoot, #btkxezdvhk tr, #btkxezdvhk td, #btkxezdvhk th {
#> border-style: none;
#> }
#>
-#> #bdpixpkpcq p {
+#> #btkxezdvhk p {
#> margin: 0;
#> padding: 0;
#> }
#>
-#> #bdpixpkpcq .gt_table {
+#> #btkxezdvhk .gt_table {
#> display: table;
#> border-collapse: collapse;
#> line-height: normal;
@@ -265,12 +265,12 @@ model plot (with stRoke::ci_plot()
#> border-left-color: #D3D3D3;
#> }
#>
-#> #bdpixpkpcq .gt_caption {
+#> #btkxezdvhk .gt_caption {
#> padding-top: 4px;
#> padding-bottom: 4px;
#> }
#>
-#> #bdpixpkpcq .gt_title {
+#> #btkxezdvhk .gt_title {
#> color: #333333;
#> font-size: 125%;
#> font-weight: initial;
@@ -282,7 +282,7 @@ model plot (with stRoke::ci_plot()
#> border-bottom-width: 0;
#> }
#>
-#> #bdpixpkpcq .gt_subtitle {
+#> #btkxezdvhk .gt_subtitle {
#> color: #333333;
#> font-size: 85%;
#> font-weight: initial;
@@ -294,7 +294,7 @@ model plot (with stRoke::ci_plot()
#> border-top-width: 0;
#> }
#>
-#> #bdpixpkpcq .gt_heading {
+#> #btkxezdvhk .gt_heading {
#> background-color: #FFFFFF;
#> text-align: center;
#> border-bottom-color: #FFFFFF;
@@ -306,13 +306,13 @@ model plot (with stRoke::ci_plot()
#> border-right-color: #D3D3D3;
#> }
#>
-#> #bdpixpkpcq .gt_bottom_border {
+#> #btkxezdvhk .gt_bottom_border {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
-#> #bdpixpkpcq .gt_col_headings {
+#> #btkxezdvhk .gt_col_headings {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
@@ -327,7 +327,7 @@ model plot (with stRoke::ci_plot()
#> border-right-color: #D3D3D3;
#> }
#>
-#> #bdpixpkpcq .gt_col_heading {
+#> #btkxezdvhk .gt_col_heading {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
@@ -347,7 +347,7 @@ model plot (with stRoke::ci_plot()
#> overflow-x: hidden;
#> }
#>
-#> #bdpixpkpcq .gt_column_spanner_outer {
+#> #btkxezdvhk .gt_column_spanner_outer {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
@@ -359,15 +359,15 @@ model plot (with stRoke::ci_plot()
#> padding-right: 4px;
#> }
#>
-#> #bdpixpkpcq .gt_column_spanner_outer:first-child {
+#> #btkxezdvhk .gt_column_spanner_outer:first-child {
#> padding-left: 0;
#> }
#>
-#> #bdpixpkpcq .gt_column_spanner_outer:last-child {
+#> #btkxezdvhk .gt_column_spanner_outer:last-child {
#> padding-right: 0;
#> }
#>
-#> #bdpixpkpcq .gt_column_spanner {
+#> #btkxezdvhk .gt_column_spanner {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
@@ -379,11 +379,11 @@ model plot (with stRoke::ci_plot()
#> width: 100%;
#> }
#>
-#> #bdpixpkpcq .gt_spanner_row {
+#> #btkxezdvhk .gt_spanner_row {
#> border-bottom-style: hidden;
#> }
#>
-#> #bdpixpkpcq .gt_group_heading {
+#> #btkxezdvhk .gt_group_heading {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
@@ -409,7 +409,7 @@ model plot (with stRoke::ci_plot()
#> text-align: left;
#> }
#>
-#> #bdpixpkpcq .gt_empty_group_heading {
+#> #btkxezdvhk .gt_empty_group_heading {
#> padding: 0.5px;
#> color: #333333;
#> background-color: #FFFFFF;
@@ -424,15 +424,15 @@ model plot (with stRoke::ci_plot()
#> vertical-align: middle;
#> }
#>
-#> #bdpixpkpcq .gt_from_md > :first-child {
+#> #btkxezdvhk .gt_from_md > :first-child {
#> margin-top: 0;
#> }
#>
-#> #bdpixpkpcq .gt_from_md > :last-child {
+#> #btkxezdvhk .gt_from_md > :last-child {
#> margin-bottom: 0;
#> }
#>
-#> #bdpixpkpcq .gt_row {
+#> #btkxezdvhk .gt_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
@@ -451,7 +451,7 @@ model plot (with stRoke::ci_plot()
#> overflow-x: hidden;
#> }
#>
-#> #bdpixpkpcq .gt_stub {
+#> #btkxezdvhk .gt_stub {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
@@ -464,7 +464,7 @@ model plot (with stRoke::ci_plot()
#> padding-right: 5px;
#> }
#>
-#> #bdpixpkpcq .gt_stub_row_group {
+#> #btkxezdvhk .gt_stub_row_group {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
@@ -478,15 +478,15 @@ model plot (with stRoke::ci_plot()
#> vertical-align: top;
#> }
#>
-#> #bdpixpkpcq .gt_row_group_first td {
+#> #btkxezdvhk .gt_row_group_first td {
#> border-top-width: 2px;
#> }
#>
-#> #bdpixpkpcq .gt_row_group_first th {
+#> #btkxezdvhk .gt_row_group_first th {
#> border-top-width: 2px;
#> }
#>
-#> #bdpixpkpcq .gt_summary_row {
+#> #btkxezdvhk .gt_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
@@ -496,16 +496,16 @@ model plot (with stRoke::ci_plot()
#> padding-right: 5px;
#> }
#>
-#> #bdpixpkpcq .gt_first_summary_row {
+#> #btkxezdvhk .gt_first_summary_row {
#> border-top-style: solid;
#> border-top-color: #D3D3D3;
#> }
#>
-#> #bdpixpkpcq .gt_first_summary_row.thick {
+#> #btkxezdvhk .gt_first_summary_row.thick {
#> border-top-width: 2px;
#> }
#>
-#> #bdpixpkpcq .gt_last_summary_row {
+#> #btkxezdvhk .gt_last_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
@@ -515,7 +515,7 @@ model plot (with stRoke::ci_plot()
#> border-bottom-color: #D3D3D3;
#> }
#>
-#> #bdpixpkpcq .gt_grand_summary_row {
+#> #btkxezdvhk .gt_grand_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
@@ -525,7 +525,7 @@ model plot (with stRoke::ci_plot()
#> padding-right: 5px;
#> }
#>
-#> #bdpixpkpcq .gt_first_grand_summary_row {
+#> #btkxezdvhk .gt_first_grand_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
@@ -535,7 +535,7 @@ model plot (with stRoke::ci_plot()
#> border-top-color: #D3D3D3;
#> }
#>
-#> #bdpixpkpcq .gt_last_grand_summary_row_top {
+#> #btkxezdvhk .gt_last_grand_summary_row_top {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
@@ -545,11 +545,11 @@ model plot (with stRoke::ci_plot()
#> border-bottom-color: #D3D3D3;
#> }
#>
-#> #bdpixpkpcq .gt_striped {
+#> #btkxezdvhk .gt_striped {
#> background-color: rgba(128, 128, 128, 0.05);
#> }
#>
-#> #bdpixpkpcq .gt_table_body {
+#> #btkxezdvhk .gt_table_body {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
@@ -558,7 +558,7 @@ model plot (with stRoke::ci_plot()
#> border-bottom-color: #D3D3D3;
#> }
#>
-#> #bdpixpkpcq .gt_footnotes {
+#> #btkxezdvhk .gt_footnotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
@@ -572,7 +572,7 @@ model plot (with stRoke::ci_plot()
#> border-right-color: #D3D3D3;
#> }
#>
-#> #bdpixpkpcq .gt_footnote {
+#> #btkxezdvhk .gt_footnote {
#> margin: 0px;
#> font-size: 90%;
#> padding-top: 4px;
@@ -581,7 +581,7 @@ model plot (with stRoke::ci_plot()
#> padding-right: 5px;
#> }
#>
-#> #bdpixpkpcq .gt_sourcenotes {
+#> #btkxezdvhk .gt_sourcenotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
@@ -595,7 +595,7 @@ model plot (with stRoke::ci_plot()
#> border-right-color: #D3D3D3;
#> }
#>
-#> #bdpixpkpcq .gt_sourcenote {
+#> #btkxezdvhk .gt_sourcenote {
#> font-size: 90%;
#> padding-top: 4px;
#> padding-bottom: 4px;
@@ -603,63 +603,63 @@ model plot (with stRoke::ci_plot()
#> padding-right: 5px;
#> }
#>
-#> #bdpixpkpcq .gt_left {
+#> #btkxezdvhk .gt_left {
#> text-align: left;
#> }
#>
-#> #bdpixpkpcq .gt_center {
+#> #btkxezdvhk .gt_center {
#> text-align: center;
#> }
#>
-#> #bdpixpkpcq .gt_right {
+#> #btkxezdvhk .gt_right {
#> text-align: right;
#> font-variant-numeric: tabular-nums;
#> }
#>
-#> #bdpixpkpcq .gt_font_normal {
+#> #btkxezdvhk .gt_font_normal {
#> font-weight: normal;
#> }
#>
-#> #bdpixpkpcq .gt_font_bold {
+#> #btkxezdvhk .gt_font_bold {
#> font-weight: bold;
#> }
#>
-#> #bdpixpkpcq .gt_font_italic {
+#> #btkxezdvhk .gt_font_italic {
#> font-style: italic;
#> }
#>
-#> #bdpixpkpcq .gt_super {
+#> #btkxezdvhk .gt_super {
#> font-size: 65%;
#> }
#>
-#> #bdpixpkpcq .gt_footnote_marks {
+#> #btkxezdvhk .gt_footnote_marks {
#> font-size: 75%;
#> vertical-align: 0.4em;
#> position: initial;
#> }
#>
-#> #bdpixpkpcq .gt_asterisk {
+#> #btkxezdvhk .gt_asterisk {
#> font-size: 100%;
#> vertical-align: 0;
#> }
#>
-#> #bdpixpkpcq .gt_indent_1 {
+#> #btkxezdvhk .gt_indent_1 {
#> text-indent: 5px;
#> }
#>
-#> #bdpixpkpcq .gt_indent_2 {
+#> #btkxezdvhk .gt_indent_2 {
#> text-indent: 10px;
#> }
#>
-#> #bdpixpkpcq .gt_indent_3 {
+#> #btkxezdvhk .gt_indent_3 {
#> text-indent: 15px;
#> }
#>
-#> #bdpixpkpcq .gt_indent_4 {
+#> #btkxezdvhk .gt_indent_4 {
#> text-indent: 20px;
#> }
#>
-#> #bdpixpkpcq .gt_indent_5 {
+#> #btkxezdvhk .gt_indent_5 {
#> text-indent: 25px;
#> }
#> </style>
diff --git a/news/index.html b/news/index.html
index 9aba623..e130ff4 100644
--- a/news/index.html
+++ b/news/index.html
@@ -58,6 +58,7 @@
NEW: chunks_of_n()
uses split()
to separate supplied vector or data frame into chunks of n. Flags to set if all but the last chunks should be exactly size n, or if they should be evenly sized of max n. Labels can be provided including regex pattern for subject naming to include in chunk names.
NEW: n_chunks()
is the opposite of chunks_of_n()
and is simply a wrapper for this function to create list of n chunks based of provided vector or data frame.
NEW: str_extract()
will extract the substring of a character string given by a regex pattern. Came to be as a helper function for labelling chunks in chunks_of_n()
, but will be useful on its own. Other functions doing the same exists, but this is my take only using base R . Draws on REDCapCAST::strsplitx()
, where splits can be performed around a pattern.
+NEW: add_padding()
was created out of frustration. I wanted to add padding using sprintf("%0s",string)
, in examples for the above, but it would fail when rendering on Windows. Say hello to another function. Just very small. Defaults to adding leading zeros, to get all string to equal length with the longer string supplied.
Deprecation: ds2dd()
moved to REDCapCAST::ds2dd()
as this is where it belongs.
diff --git a/pkgdown.yml b/pkgdown.yml
index 94fedf9..f428acd 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -4,7 +4,7 @@ pkgdown_sha: ~
articles:
ds2dd: ds2dd.html
toolbox: toolbox.html
-last_built: 2023-09-05T17:59Z
+last_built: 2023-09-05T21:13Z
urls:
reference: https://agdamsbo.github.io/stRoke/reference
article: https://agdamsbo.github.io/stRoke/articles
diff --git a/reference/add_padding.html b/reference/add_padding.html
new file mode 100644
index 0000000..9270725
--- /dev/null
+++ b/reference/add_padding.html
@@ -0,0 +1,114 @@
+
+Add padding to string — add_padding • stRoke
+ Skip to contents
+
+
+
+
+
stRoke
+
+
23.9.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add padding to string
+
+
+
+
Usage
+
add_padding ( d , length = NULL , after = FALSE , pad = "0" )
+
+
+
+
Arguments
+
d
+vector of strings or numbers
+
+
+length
+final string length
+
+
+after
+if padding should be added after as opposed to default before
+
+
+pad
+padding string of length 1
+
+
+
+
Value
+
+
+
vector or character strings of same length.
+
+
+
+
Examples
+
add_padding ( sample ( 1 : 200 ,5 ) )
+#> [1] "115" "063" "174" "186" "184"
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/reference/chunks_of_n.html b/reference/chunks_of_n.html
index 799cade..da96ba1 100644
--- a/reference/chunks_of_n.html
+++ b/reference/chunks_of_n.html
@@ -114,51 +114,51 @@ frame, will assume first column is name.
#> [1] 95 96 97 98 99 100
#>
ds <- data.frame ( nm= paste0 ( "Sub" ,
-sprintf ( "%03s" , rownames ( stRoke :: talos ) ) ) ,stRoke :: talos )
+add_padding ( rownames ( stRoke :: talos ) ) ) ,stRoke :: talos )
head ( chunks_of_n ( ds ,7 ,pattern= "Sub[0-9]{3}" ,label= "grp" ) ,2 )
-#> $`grp-NA-NA`
+#> $`grp-Sub038-Sub011`
#> nm rtreat mrs_1 mrs_6 hypertension diabetes civil
-#> 38 Sub 38 Active 1 1 no no partner
+#> 38 Sub038 Active 1 1 no no partner
#> 434 Sub434 Active 1 1 yes no partner
#> 588 Sub588 Active 2 2 yes no partner
-#> 42 Sub 42 Active 0 0 yes no partner
+#> 42 Sub042 Active 0 0 yes no partner
#> 160 Sub160 Placebo 1 1 yes no partner
#> 174 Sub174 Active 0 1 yes no alone
-#> 11 Sub 11 Placebo 2 1 yes yes alone
+#> 11 Sub011 Placebo 2 1 yes yes alone
#>
-#> $`grp-Sub601-NA`
+#> $`grp-Sub601-Sub062`
#> nm rtreat mrs_1 mrs_6 hypertension diabetes civil
#> 601 Sub601 Placebo 1 1 no no partner
#> 412 Sub412 Active 0 0 yes no partner
-#> 88 Sub 88 Placebo 1 1 yes yes partner
-#> 56 Sub 56 Placebo 0 0 no no alone
+#> 88 Sub088 Placebo 1 1 yes yes partner
+#> 56 Sub056 Placebo 0 0 no no alone
#> 235 Sub235 Placebo 2 1 yes yes alone
#> 205 Sub205 Active 3 3 no no partner
-#> 62 Sub 62 Active 2 2 yes no alone
+#> 62 Sub062 Active 2 2 yes no alone
#>
## Please notice that no sorting is performed. This is on purpose to preserve
## original sorting. If sorting is intended, try something like this:
ds [ order ( ds $ nm ) ,] |> chunks_of_n ( 7 ,pattern= "Sub[0-9]{3}" ,label= "grp" ) |>
head ( 2 )
-#> $`grp-NA-NA`
+#> $`grp-Sub001-Sub020`
#> nm rtreat mrs_1 mrs_6 hypertension diabetes civil
-#> 1 Sub 1 Placebo 0 0 yes no partner
-#> 2 Sub 2 Placebo 2 1 no no partner
-#> 7 Sub 7 Placebo 1 1 yes no partner
-#> 9 Sub 9 Placebo 1 1 no no partner
-#> 11 Sub 11 Placebo 2 1 yes yes alone
-#> 13 Sub 13 Active 1 1 yes no partner
-#> 20 Sub 20 Placebo 1 2 no no alone
+#> 1 Sub001 Placebo 0 0 yes no partner
+#> 2 Sub002 Placebo 2 1 no no partner
+#> 7 Sub007 Placebo 1 1 yes no partner
+#> 9 Sub009 Placebo 1 1 no no partner
+#> 11 Sub011 Placebo 2 1 yes yes alone
+#> 13 Sub013 Active 1 1 yes no partner
+#> 20 Sub020 Placebo 1 2 no no alone
#>
-#> $`grp-NA-NA`
+#> $`grp-Sub022-Sub038`
#> nm rtreat mrs_1 mrs_6 hypertension diabetes civil
-#> 22 Sub 22 Placebo 2 1 no no partner
-#> 26 Sub 26 Placebo 2 4 no no alone
-#> 28 Sub 28 Active 2 2 yes no partner
-#> 29 Sub 29 Placebo 2 2 no no alone
-#> 33 Sub 33 Placebo 0 0 yes no alone
-#> 34 Sub 34 Active 1 1 no no alone
-#> 38 Sub 38 Active 1 1 no no partner
+#> 22 Sub022 Placebo 2 1 no no partner
+#> 26 Sub026 Placebo 2 4 no no alone
+#> 28 Sub028 Active 2 2 yes no partner
+#> 29 Sub029 Placebo 2 2 no no alone
+#> 33 Sub033 Placebo 0 0 yes no alone
+#> 34 Sub034 Active 1 1 no no alone
+#> 38 Sub038 Active 1 1 no no partner
#>
diff --git a/reference/color_plot-1.png b/reference/color_plot-1.png
index eb89bb0..3f389c7 100644
Binary files a/reference/color_plot-1.png and b/reference/color_plot-1.png differ
diff --git a/reference/index.html b/reference/index.html
index 7619479..2e4705d 100644
--- a/reference/index.html
+++ b/reference/index.html
@@ -63,6 +63,11 @@
+ add_padding()
+
+ Add padding to string
+
+
age_calc()
Calculate age in years, months, or days
diff --git a/reference/label_select.html b/reference/label_select.html
index c948a4d..38a9b75 100644
--- a/reference/label_select.html
+++ b/reference/label_select.html
@@ -94,15 +94,15 @@ Alternative is to use attributes, eg from label_select ( labels_all ,vars )
#> [[1]]
#> hypertension ~ "Known hypertension"
-#> <environment: 0x556388413c80>
+#> <environment: 0x556d47a96c98>
#>
#> [[2]]
#> diabetes ~ "Known diabetes"
-#> <environment: 0x556388413c80>
+#> <environment: 0x556d47a96c98>
#>
#> [[3]]
#> mrs_1 ~ "One month mRS"
-#> <environment: 0x556388413c80>
+#> <environment: 0x556d47a96c98>
#>
## With gtsummary::tbl_summary()
diff --git a/reference/quantile_cut.html b/reference/quantile_cut.html
index 2f54f0a..d3cf427 100644
--- a/reference/quantile_cut.html
+++ b/reference/quantile_cut.html
@@ -120,8 +120,8 @@ as borders in case of y!=NULL.
x <- 1 : 450
y <- 6 : 750
summary ( quantile_cut ( aa ,groups= 4 ,detail.list= FALSE ) ) ## Cuts quartiles
-#> [1,260] (260,500] (500,744] (744,1e+03]
-#> 500 501 499 500
+#> [1,240] (240,485] (485,736] (736,1e+03]
+#> 502 500 498 500
On this page
diff --git a/reference/write_ical.html b/reference/write_ical.html
index 0609670..1500ad5 100644
--- a/reference/write_ical.html
+++ b/reference/write_ical.html
@@ -171,8 +171,8 @@ a time zone that is recognized by the user's OS.
#> # A tibble: 2 × 7
#> SUMMARY DTSTART DTEND UID LOCATION URL
#> <chr> <dttm> <dttm> <chr> <chr> <chr>
-#> 1 Conference 2020-02-10 12:00:00 2020-02-13 13:00:00 ical-c1d368… Confere… http…
-#> 2 Lunch 2020-02-11 10:00:00 2020-02-11 11:00:00 ical-0cb59a… Confere… http…
+#> 1 Conference 2020-02-10 12:00:00 2020-02-13 13:00:00 ical-df4d1e… Confere… http…
+#> 2 Lunch 2020-02-11 10:00:00 2020-02-11 11:00:00 ical-6fdb7c… Confere… http…
#> # ℹ 1 more variable: DESCRIPTION <chr>
diff --git a/search.json b/search.json
index 07bdba6..f92d94a 100644
--- a/search.json
+++ b/search.json
@@ -1 +1 @@
-[{"path":"https://agdamsbo.github.io/stRoke/articles/ds2dd.html","id":"easy-data-set-to-data-base-workflow","dir":"Articles","previous_headings":"","what":"Easy data set to data base workflow","title":"ds2dd","text":"function can used simple tool creating data base metadata file REDCap (called DataDictionary) based given data set file.","code":""},{"path":"https://agdamsbo.github.io/stRoke/articles/ds2dd.html","id":"step-1---load-your-data-set","dir":"Articles","previous_headings":"Easy data set to data base workflow","what":"Step 1 - Load your data set","title":"ds2dd","text":"’ll use sample TALOS dataset included package.","code":"data(\"talos\") ds <- talos # As the data set lacks an ID column, one is added ds$id <- seq_len(nrow(ds))"},{"path":"https://agdamsbo.github.io/stRoke/articles/ds2dd.html","id":"step-2---create-the-datadictionary","dir":"Articles","previous_headings":"Easy data set to data base workflow","what":"Step 2 - Create the DataDictionary","title":"ds2dd","text":"Now additional specifications DataDictionary can made manually, can uploaded modified manually graphical user interface web page. function transform column names lower case substitute spaces underscores. output list DataDictionary vector new column names dataset fit meta data.","code":"datadictionary <- ds2dd(ds,record.id = \"id\",include.column.names = TRUE)"},{"path":"https://agdamsbo.github.io/stRoke/articles/ds2dd.html","id":"step-3---meta-data-upload","dir":"Articles","previous_headings":"Easy data set to data base workflow","what":"Step 3 - Meta data upload","title":"ds2dd","text":"Now DataDictionary can exported spreadsheet uploaded can uploaded using REDCapR package (projects “Development” status). Use one two approaches :","code":""},{"path":"https://agdamsbo.github.io/stRoke/articles/ds2dd.html","id":"manual-upload","dir":"Articles","previous_headings":"Easy data set to data base workflow > Step 3 - Meta data upload","what":"Manual upload","title":"ds2dd","text":"","code":"write.csv(datadictionary$DataDictionary,\"datadictionary.csv\")"},{"path":"https://agdamsbo.github.io/stRoke/articles/ds2dd.html","id":"upload-with-redcapr","dir":"Articles","previous_headings":"Easy data set to data base workflow > Step 3 - Meta data upload","what":"Upload with REDCapR","title":"ds2dd","text":"“REDCap R Handbook” written interfacing REDCap R using library(keyring)store credentials chapter 1.1.","code":"REDCapR::redcap_metadata_write( datadictionary$DataDictionary, redcap_uri = keyring::key_get(\"DB_URI\"), token = keyring::key_get(\"DB_TOKEN\") )"},{"path":"https://agdamsbo.github.io/stRoke/articles/ds2dd.html","id":"step-4---data-upload","dir":"Articles","previous_headings":"Easy data set to data base workflow","what":"Step 4 - Data upload","title":"ds2dd","text":"two options available data upload meta data upload: manual REDCapR. latter shown .","code":"# new column names are applied colnames(ds) <- datadictionary$`Column names` REDCapR::redcap_write( ds, redcap_uri = keyring::key_get(\"DB_URI\"), token = keyring::key_get(\"DB_TOKEN\") )"},{"path":"https://agdamsbo.github.io/stRoke/articles/toolbox.html","id":"a-toolbox","dir":"Articles","previous_headings":"","what":"A toolbox","title":"Toolbox","text":"toolbox small workshop mix old, worn, well proven tools newcomers. package seen something like . tried collect tools functions packages use regularly addition functions written fill use cases, able find solutions elsewhere. documenting testing package, used OpenAI’s chatgpt gpttools. chatgpt interesting tool, way perfect, helps tedious tasks. gpttools gptstudio interesting implementations R RStudio.","code":""},{"path":"https://agdamsbo.github.io/stRoke/articles/toolbox.html","id":"cpr-intro","dir":"Articles","previous_headings":"A toolbox","what":"CPR manipulations","title":"Toolbox","text":"Note , handled, CPR numbers (social security numbers) handled care considered highly sensitive data. CPR number structured DDMMYY-XXXX, 1st X designating decade birth, last X designate binary gender (biological sex) dependent even/uneven female/male, last digits used modulus calculation verify validity CPR number. Foreigners unidentified persons given temporary CPR numbers including letters. information can found cpr.dk. Note, CPR numbers used examples publicly known non-organic.","code":""},{"path":"https://agdamsbo.github.io/stRoke/articles/toolbox.html","id":"age_calc","dir":"Articles","previous_headings":"A toolbox > CPR manipulations","what":"age_calc()","title":"Toolbox","text":"age_calc() function created learning exercise functions similarly lubridate::time_length().","code":"(age <- age_calc(as.Date(\"1945-10-23\"), as.Date(\"2018-09-30\"))) #> [1] 72.93699 trunc(age) #> [1] 72"},{"path":"https://agdamsbo.github.io/stRoke/articles/toolbox.html","id":"cpr_check","dir":"Articles","previous_headings":"A toolbox > CPR manipulations","what":"cpr_check()","title":"Toolbox","text":"Checks validity CPR numbers according modulus 11 rule. Note due limitations possible available CPR numbers, rule apply CPR numbers 2007. Including CPR numbers letters gives warning NA, can checked modulus 11 function. used care, see message.","code":"cpr_check( c( \"2310450637\", \"010190-2000\", \"010115-4000\", \"300450-1030\", \"010150-4021\", \"010150-4AA1\" ) ) #> OBS: as per 2007 not all valid CPR numbers apply to modulus 11 rule. #> #> See the vignette 'Toolbox' #> Warning in matrix(as.numeric(unlist(strsplit(cpr_short, \"\"))), nrow = 10): NAs #> introduced by coercion #> [1] TRUE FALSE FALSE FALSE FALSE NA"},{"path":"https://agdamsbo.github.io/stRoke/articles/toolbox.html","id":"cpr_dob","dir":"Articles","previous_headings":"A toolbox > CPR manipulations","what":"cpr_dob()","title":"Toolbox","text":"Extracts date birth (DOB) CPR number. Accounts decade birth. See earlier.","code":"cpr_dob(c( \"2310450637\", \"010190-2000\", \"010115-4000\", \"300450-1030\", \"010150-4021\" )) #> [1] \"23-10-1945\" \"01-01-1990\" \"01-01-2015\" \"30-04-1950\" \"01-01-1950\""},{"path":"https://agdamsbo.github.io/stRoke/articles/toolbox.html","id":"cpr_female","dir":"Articles","previous_headings":"A toolbox > CPR manipulations","what":"cpr_female()","title":"Toolbox","text":"Gives logical vector whether female gender last digit CPR.","code":"table(cpr_female(stRoke::cprs[, 1])) #> #> FALSE TRUE #> 98 102"},{"path":[]},{"path":"https://agdamsbo.github.io/stRoke/articles/toolbox.html","id":"ci_plot","dir":"Articles","previous_headings":"A toolbox > Plotting","what":"ci_plot()","title":"Toolbox","text":"Plots odds ratios 95 % confidence intervals. Performs binary logistic regression outcome factors two (2) levels ordinal logistic regression outcome factors two levels. Mind relevant assumptions. Outputs ggplot element manipulation.","code":"data(talos) talos[, \"mrs_1\"] <- factor(talos[, \"mrs_1\"], ordered = TRUE) ci_plot( ds = talos, x = \"rtreat\", y = \"mrs_1\", vars = c(\"hypertension\", \"diabetes\") ) #> Waiting for profiling to be done..."},{"path":"https://agdamsbo.github.io/stRoke/articles/toolbox.html","id":"generic_stroke","dir":"Articles","previous_headings":"A toolbox > Plotting","what":"generic_stroke()","title":"Toolbox","text":"learning purposes. Uses annonymized data TALOS trial output Table 1 (gtsummary::tbl_summary()), plotting -called grotta-bars based mRS scores (rankinPlot::grottaBar()) ordinal logistic regression model plot (stRoke::ci_plot()).","code":"generic_stroke(stRoke::talos, \"rtreat\", \"mrs_6\", variables = c(\"hypertension\", \"diabetes\", \"civil\")) #> Waiting for profiling to be done... #> $`Table 1` #> #>