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 + + +
+
+
+ +
+

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