diff --git a/pkgdown.yml b/pkgdown.yml index b911943..90bdd7b 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.1.1 pkgdown_sha: ~ articles: FreesearchR: FreesearchR.html -last_built: 2025-03-19T12:46Z +last_built: 2025-03-24T14:15Z urls: reference: https://agdamsbo.github.io/FreesearchR/reference article: https://agdamsbo.github.io/FreesearchR/articles diff --git a/reference/append_list.html b/reference/append_list.html index 2751c11..fddb877 100644 --- a/reference/append_list.html +++ b/reference/append_list.html @@ -68,9 +68,9 @@

Examples

-
ls_d <- list(test=c(1:20))
+    
ls_d <- list(test = c(1:20))
 ls_d <- list()
-data.frame(letters[1:20],1:20) |> append_list(ls_d,"letters")
+data.frame(letters[1:20], 1:20) |> append_list(ls_d, "letters")
 #> $letters
 #>    letters.1.20. X1.20
 #> 1              a     1
@@ -94,7 +94,7 @@
 #> 19             s    19
 #> 20             t    20
 #> 
-letters[1:20]|> append_list(ls_d,"letters")
+letters[1:20] |> append_list(ls_d, "letters")
 #> $letters
 #>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
 #> [20] "t"
diff --git a/reference/baseline_table.html b/reference/baseline_table.html
index 7962d4b..562ee29 100644
--- a/reference/baseline_table.html
+++ b/reference/baseline_table.html
@@ -107,7 +107,7 @@
 1 (3.1%)    8
 1 (3.1%)1 Median (Q1, Q3); n (%)
     
mtcars |> baseline_table(fun.args = list(by = "gear")) -
+
Characteristic 3
diff --git a/reference/clean_common_axis.html b/reference/clean_common_axis.html new file mode 100644 index 0000000..1cc25ef --- /dev/null +++ b/reference/clean_common_axis.html @@ -0,0 +1,84 @@ + +Extract and clean axis ranges — clean_common_axis • FreesearchR + Skip to contents + + +
+
+
+ +
+

Extract and clean axis ranges

+
+ +
+

Usage

+
clean_common_axis(p, axis)
+
+ +
+

Arguments

+ + +
p
+

plot

+ + +
axis
+

axis. x or y.

+ +
+
+

Value

+

vector

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/create_baseline.html b/reference/create_baseline.html new file mode 100644 index 0000000..4618251 --- /dev/null +++ b/reference/create_baseline.html @@ -0,0 +1,189 @@ + +Create a baseline table — create_baseline • FreesearchR + Skip to contents + + +
+
+
+ +
+

Create a baseline table

+
+ +
+

Usage

+
create_baseline(data, ..., by.var, add.p = FALSE, add.overall = FALSE)
+
+ +
+

Arguments

+ + +
data
+

data

+ + +
...
+

passed as fun.arg to baseline_table()

+ + +
add.p
+

add comparison/p-value

+ + +
add.overall
+

add overall column

+ + +
strat.var
+

grouping/strat variable

+ +
+
+

Value

+

gtsummary table list object

+
+ +
+

Examples

+
mtcars |> create_baseline(by.var = "gear", add.p="yes"=="yes")
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Characteristic3
+N = 15
1
4
+N = 12
1
5
+N = 5
1
p-value2
mpg15.5 (14.3, 18.7)22.8 (21.0, 28.9)19.7 (15.8, 26.0)<0.001
cyl


<0.001
    41 (6.7%)8 (67%)2 (40%)
    62 (13%)4 (33%)1 (20%)
    812 (80%)0 (0%)2 (40%)
disp318 (276, 400)131 (79, 160)145 (120, 301)<0.001
hp180 (150, 215)94 (66, 110)175 (113, 264)<0.001
drat3.08 (3.00, 3.21)3.92 (3.90, 4.10)3.77 (3.62, 4.22)<0.001
wt3.73 (3.44, 4.07)2.70 (2.07, 3.17)2.77 (2.14, 3.17)<0.001
qsec17.42 (17.02, 18.00)18.76 (18.41, 19.69)15.50 (14.60, 16.70)0.002
vs3 (20%)10 (83%)1 (20%)0.001
am0 (0%)8 (67%)5 (100%)<0.001
carb


0.2
    13 (20%)4 (33%)0 (0%)
    24 (27%)4 (33%)2 (40%)
    33 (20%)0 (0%)0 (0%)
    45 (33%)4 (33%)1 (20%)
    60 (0%)0 (0%)1 (20%)
    80 (0%)0 (0%)1 (20%)
1 Median (Q1, Q3); n (%)
2 Kruskal-Wallis rank sum test; Fisher’s exact test
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/create_log_tics.html b/reference/create_log_tics.html new file mode 100644 index 0000000..4a0594f --- /dev/null +++ b/reference/create_log_tics.html @@ -0,0 +1,86 @@ + +Create summetric log ticks — create_log_tics • FreesearchR + Skip to contents + + +
+
+
+ +
+

Create summetric log ticks

+
+ +
+

Usage

+
create_log_tics(data)
+
+ +
+

Arguments

+ + +
data
+

numeric vector

+ +
+
+

Value

+

numeric vector

+
+ +
+

Examples

+
c(sample(seq(.1, 1, .1), 3), sample(1:10, 3)) |> create_log_tics()
+#>  [1] 0.17 0.20 0.25 0.33 0.50 1.00 2.00 3.00 4.00 5.00 6.00
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/data-plots-1.png b/reference/data-plots-1.png index 42a8c68..fe8b662 100644 Binary files a/reference/data-plots-1.png and b/reference/data-plots-1.png differ diff --git a/reference/data-plots-10.png b/reference/data-plots-10.png new file mode 100644 index 0000000..1240cf1 Binary files /dev/null and b/reference/data-plots-10.png differ diff --git a/reference/data-plots-2.png b/reference/data-plots-2.png index 65f94a5..d65108d 100644 Binary files a/reference/data-plots-2.png and b/reference/data-plots-2.png differ diff --git a/reference/data-plots-3.png b/reference/data-plots-3.png index b448f5f..42a8c68 100644 Binary files a/reference/data-plots-3.png and b/reference/data-plots-3.png differ diff --git a/reference/data-plots-4.png b/reference/data-plots-4.png index d8a1a36..65f94a5 100644 Binary files a/reference/data-plots-4.png and b/reference/data-plots-4.png differ diff --git a/reference/data-plots-5.png b/reference/data-plots-5.png index 98e6907..b448f5f 100644 Binary files a/reference/data-plots-5.png and b/reference/data-plots-5.png differ diff --git a/reference/data-plots-6.png b/reference/data-plots-6.png index 6e51c2c..7284e56 100644 Binary files a/reference/data-plots-6.png and b/reference/data-plots-6.png differ diff --git a/reference/data-plots-7.png b/reference/data-plots-7.png index 0f0df97..0e78d1f 100644 Binary files a/reference/data-plots-7.png and b/reference/data-plots-7.png differ diff --git a/reference/data-plots-8.png b/reference/data-plots-8.png index 1240cf1..42f84f9 100644 Binary files a/reference/data-plots-8.png and b/reference/data-plots-8.png differ diff --git a/reference/data-plots-9.png b/reference/data-plots-9.png new file mode 100644 index 0000000..0f0df97 Binary files /dev/null and b/reference/data-plots-9.png differ diff --git a/reference/data-plots.html b/reference/data-plots.html index 278c795..881be9e 100644 --- a/reference/data-plots.html +++ b/reference/data-plots.html @@ -1,6 +1,8 @@ Data correlations evaluation module — data-plots • FreesearchR

Data correlations evaluation module

Wrapper to create plot based on provided type

+

Beautiful box plot(s)

+

Create nice box-plots

Nice horizontal stacked bars (Grotta bars)

Plot nice ridge plot

Readying data for sankey plot

@@ -69,6 +75,10 @@ Beatiful violin plot"> create_plot(data, type, x, y, z = NULL, ...) +plot_box(data, x, y, z = NULL) + +plot_box_single(data, x, y = NULL, seed = 2103) + plot_hbars(data, x, y, z = NULL) plot_ridge(data, x, y, z = NULL, ...) @@ -120,6 +130,8 @@ Beatiful violin plot">

shiny server module

ggplot2 object

ggplot2 object

+

ggplot object

+

ggplot2 object

ggplot2 object

data.frame

ggplot2 object

@@ -131,19 +143,31 @@ Beatiful violin plot">

Examples

create_plot(mtcars, "plot_violin", "mpg", "cyl")
 #> Error in if (!z %in% names(data)) {    z <- NULL}: argument is of length zero
+mtcars |> plot_box(x = "mpg", y = "cyl", z = "gear")
+#> Error in purrr::map(p, ~ggplot2::layer_scales(.x)[[axis]]$get_limits()):  In index: 2.
+#>  With name: 4.
+#> Caused by error in `viridis::scale_fill_viridis()`:
+#> ! Continuous values supplied to discrete scale.
+#>  Example values: 4 and 6
+mtcars |>
+  default_parsing() |>
+  plot_box(x = "mpg", y = "cyl", z = "gear")
+
+mtcars |> plot_box_single("mpg","cyl")
+
 mtcars |> plot_hbars(x = "carb", y = "cyl")
 #> Scale for fill is already present.
 #> Adding another scale for fill, which will replace the existing scale.
-
+
 mtcars |> plot_hbars(x = "carb", y = NULL)
 #> Scale for fill is already present.
 #> Adding another scale for fill, which will replace the existing scale.
-
+
 mtcars |>
   default_parsing() |>
   plot_ridge(x = "mpg", y = "cyl")
 #> Picking joint bandwidth of 1.38
-
+
 mtcars |> plot_ridge(x = "mpg", y = "cyl", z = "gear")
 #> Picking joint bandwidth of 1.52
 #> Warning: The following aesthetics were dropped during statistical transformation: y and
@@ -161,48 +185,48 @@ Beatiful violin plot">
 #> # A tibble: 19 × 7
 #>    first last      n gx.sum gy.sum lx          ly         
 #>    <fct> <fct> <int>  <int>  <int> <fct>       <fct>      
-#>  1 c     c         5     28     15 "c\n(n=28)" "c\n(n=15)"
-#>  2 c     a         7     28     32 "c\n(n=28)" "a\n(n=32)"
-#>  3 c     b         6     28     26 "c\n(n=28)" "b\n(n=26)"
-#>  4 c     d         6     28     17 "c\n(n=28)" "d\n(n=17)"
-#>  5 c     NA        4     28     10 "c\n(n=28)"  NA        
-#>  6 a     c         6     24     15 "a\n(n=24)" "c\n(n=15)"
-#>  7 a     a         9     24     32 "a\n(n=24)" "a\n(n=32)"
-#>  8 a     b         6     24     26 "a\n(n=24)" "b\n(n=26)"
-#>  9 a     d         1     24     17 "a\n(n=24)" "d\n(n=17)"
-#> 10 a     NA        2     24     10 "a\n(n=24)"  NA        
-#> 11 b     c         4     20     15 "b\n(n=20)" "c\n(n=15)"
-#> 12 b     a         8     20     32 "b\n(n=20)" "a\n(n=32)"
-#> 13 b     b         5     20     26 "b\n(n=20)" "b\n(n=26)"
-#> 14 b     d         2     20     17 "b\n(n=20)" "d\n(n=17)"
-#> 15 b     NA        1     20     10 "b\n(n=20)"  NA        
-#> 16 d     a         8     28     32 "d\n(n=28)" "a\n(n=32)"
-#> 17 d     b         9     28     26 "d\n(n=28)" "b\n(n=26)"
-#> 18 d     d         8     28     17 "d\n(n=28)" "d\n(n=17)"
-#> 19 d     NA        3     28     10 "d\n(n=28)"  NA        
+#>  1 d     d        11     36     18 "d\n(n=36)" "d\n(n=18)"
+#>  2 d     a        11     36     30 "d\n(n=36)" "a\n(n=30)"
+#>  3 d     b         6     36     25 "d\n(n=36)" "b\n(n=25)"
+#>  4 d     c         8     36     22 "d\n(n=36)" "c\n(n=22)"
+#>  5 c     d         3     24     18 "c\n(n=24)" "d\n(n=18)"
+#>  6 c     a         7     24     30 "c\n(n=24)" "a\n(n=30)"
+#>  7 c     b        10     24     25 "c\n(n=24)" "b\n(n=25)"
+#>  8 c     c         1     24     22 "c\n(n=24)" "c\n(n=22)"
+#>  9 c     NA        3     24      5 "c\n(n=24)"  NA        
+#> 10 b     d         2     17     18 "b\n(n=17)" "d\n(n=18)"
+#> 11 b     a         4     17     30 "b\n(n=17)" "a\n(n=30)"
+#> 12 b     b         3     17     25 "b\n(n=17)" "b\n(n=25)"
+#> 13 b     c         7     17     22 "b\n(n=17)" "c\n(n=22)"
+#> 14 b     NA        1     17      5 "b\n(n=17)"  NA        
+#> 15 a     d         2     23     18 "a\n(n=23)" "d\n(n=18)"
+#> 16 a     a         8     23     30 "a\n(n=23)" "a\n(n=30)"
+#> 17 a     b         6     23     25 "a\n(n=23)" "b\n(n=25)"
+#> 18 a     c         6     23     22 "a\n(n=23)" "c\n(n=22)"
+#> 19 a     NA        1     23      5 "a\n(n=23)"  NA        
 ds |> sankey_ready("first", "last", numbers = "percentage")
 #> # A tibble: 19 × 7
 #>    first last      n gx.sum gy.sum lx         ly        
 #>    <fct> <fct> <int>  <int>  <int> <fct>      <fct>     
-#>  1 c     c         5     28     15 "c\n(28%)" "c\n(15%)"
-#>  2 c     a         7     28     32 "c\n(28%)" "a\n(32%)"
-#>  3 c     b         6     28     26 "c\n(28%)" "b\n(26%)"
-#>  4 c     d         6     28     17 "c\n(28%)" "d\n(17%)"
-#>  5 c     NA        4     28     10 "c\n(28%)"  NA       
-#>  6 a     c         6     24     15 "a\n(24%)" "c\n(15%)"
-#>  7 a     a         9     24     32 "a\n(24%)" "a\n(32%)"
-#>  8 a     b         6     24     26 "a\n(24%)" "b\n(26%)"
-#>  9 a     d         1     24     17 "a\n(24%)" "d\n(17%)"
-#> 10 a     NA        2     24     10 "a\n(24%)"  NA       
-#> 11 b     c         4     20     15 "b\n(20%)" "c\n(15%)"
-#> 12 b     a         8     20     32 "b\n(20%)" "a\n(32%)"
-#> 13 b     b         5     20     26 "b\n(20%)" "b\n(26%)"
-#> 14 b     d         2     20     17 "b\n(20%)" "d\n(17%)"
-#> 15 b     NA        1     20     10 "b\n(20%)"  NA       
-#> 16 d     a         8     28     32 "d\n(28%)" "a\n(32%)"
-#> 17 d     b         9     28     26 "d\n(28%)" "b\n(26%)"
-#> 18 d     d         8     28     17 "d\n(28%)" "d\n(17%)"
-#> 19 d     NA        3     28     10 "d\n(28%)"  NA       
+#>  1 d     d        11     36     18 "d\n(36%)" "d\n(18%)"
+#>  2 d     a        11     36     30 "d\n(36%)" "a\n(30%)"
+#>  3 d     b         6     36     25 "d\n(36%)" "b\n(25%)"
+#>  4 d     c         8     36     22 "d\n(36%)" "c\n(22%)"
+#>  5 c     d         3     24     18 "c\n(24%)" "d\n(18%)"
+#>  6 c     a         7     24     30 "c\n(24%)" "a\n(30%)"
+#>  7 c     b        10     24     25 "c\n(24%)" "b\n(25%)"
+#>  8 c     c         1     24     22 "c\n(24%)" "c\n(22%)"
+#>  9 c     NA        3     24      5 "c\n(24%)"  NA       
+#> 10 b     d         2     17     18 "b\n(17%)" "d\n(18%)"
+#> 11 b     a         4     17     30 "b\n(17%)" "a\n(30%)"
+#> 12 b     b         3     17     25 "b\n(17%)" "b\n(25%)"
+#> 13 b     c         7     17     22 "b\n(17%)" "c\n(22%)"
+#> 14 b     NA        1     17      5 "b\n(17%)"  NA       
+#> 15 a     d         2     23     18 "a\n(23%)" "d\n(18%)"
+#> 16 a     a         8     23     30 "a\n(23%)" "a\n(30%)"
+#> 17 a     b         6     23     25 "a\n(23%)" "b\n(25%)"
+#> 18 a     c         6     23     22 "a\n(23%)" "c\n(22%)"
+#> 19 a     NA        1     23      5 "a\n(23%)"  NA       
 data.frame(
   g = sample(LETTERS[1:2], 100, TRUE),
   first = REDCapCAST::as_factor(sample(letters[1:4], 100, TRUE)),
@@ -212,24 +236,27 @@ Beatiful violin plot">
 #> # A tibble: 8 × 7
 #>   first last      n gx.sum gy.sum lx          ly             
 #>   <fct> <fct> <int>  <int>  <int> <fct>       <fct>          
-#> 1 a     FALSE    21     29     61 "a\n(n=29)" "FALSE\n(n=61)"
-#> 2 a     TRUE      8     29     39 "a\n(n=29)" "TRUE\n(n=39)" 
-#> 3 d     FALSE    12     22     61 "d\n(n=22)" "FALSE\n(n=61)"
-#> 4 d     TRUE     10     22     39 "d\n(n=22)" "TRUE\n(n=39)" 
-#> 5 b     FALSE    13     26     61 "b\n(n=26)" "FALSE\n(n=61)"
-#> 6 b     TRUE     13     26     39 "b\n(n=26)" "TRUE\n(n=39)" 
-#> 7 c     FALSE    15     23     61 "c\n(n=23)" "FALSE\n(n=61)"
-#> 8 c     TRUE      8     23     39 "c\n(n=23)" "TRUE\n(n=39)" 
+#> 1 b     FALSE    16     29     66 "b\n(n=29)" "FALSE\n(n=66)"
+#> 2 b     TRUE     13     29     34 "b\n(n=29)" "TRUE\n(n=34)" 
+#> 3 a     FALSE    18     25     66 "a\n(n=25)" "FALSE\n(n=66)"
+#> 4 a     TRUE      7     25     34 "a\n(n=25)" "TRUE\n(n=34)" 
+#> 5 d     FALSE    13     20     66 "d\n(n=20)" "FALSE\n(n=66)"
+#> 6 d     TRUE      7     20     34 "d\n(n=20)" "TRUE\n(n=34)" 
+#> 7 c     FALSE    19     26     66 "c\n(n=26)" "FALSE\n(n=66)"
+#> 8 c     TRUE      7     26     34 "c\n(n=26)" "TRUE\n(n=34)" 
 ds <- data.frame(g = sample(LETTERS[1:2], 100, TRUE), first = REDCapCAST::as_factor(sample(letters[1:4], 100, TRUE)), last = REDCapCAST::as_factor(sample(letters[1:4], 100, TRUE)))
 ds |> plot_sankey("first", "last")
 #> Loading required package: ggplot2
-
-ds |> plot_sankey("first", "last", color.group = "y")
-
-ds |> plot_sankey("first", "last", z = "g", color.group = "y")
 
-mtcars |> plot_scatter(x = "mpg", y = "wt")
+ds |> plot_sankey("first", "last", color.group = "y")
 
+ds |> plot_sankey("first", "last", z = "g", color.group = "y")
+#> Warning: Some strata appear at multiple axes.
+#> Warning: Some strata appear at multiple axes.
+#> Warning: Some strata appear at multiple axes.
+
+mtcars |> plot_scatter(x = "mpg", y = "wt")
+
 mtcars |> plot_violin(x = "mpg", y = "cyl", z = "gear")
 #> Warning: There was 1 warning in `summarize()`.
 #>  In argument: `V1 = .fun(as.data.frame(pick(everything())), var)`.
@@ -263,7 +290,7 @@ Beatiful violin plot">
 #>  Set `drop = FALSE` to consider such groups for position adjustment purposes.
 #> Warning: Groups with fewer than two datapoints have been dropped.
 #>  Set `drop = FALSE` to consider such groups for position adjustment purposes.
-
+