diff --git a/articles/FreesearchR.html b/articles/FreesearchR.html index ebdfb9e..3425329 100644 --- a/articles/FreesearchR.html +++ b/articles/FreesearchR.html @@ -266,10 +266,34 @@ visualise data distribution +

Export the plots directly from the sidebar with easily adjusted plot +dimensions for your next publication.

+

Also copy the code to generate the plot in your own R-environment and +fine tune all the small details.

Regression

+

This section is only intended for very simple explorative analyses +and as a proof-of-concept for now. If you are doing complex regression +analyses you should probably just write the code yourself.

+
+

Table +

+

Generate simple regression models and get the results in a nice +table. This will also be included in the exported report.

+
+
+

Plots +

+

Plot the coefficients from the regression models in a forest plot. +Choose which model(s) to include.

+
+
+

Checks +

+

Check model assumptions visually. Supported checks can be chosen.

+

Download @@ -277,14 +301,19 @@ visualise data distribution

Report

+

Download a nice report with baseline characteristics and regression +model results. Choose between MS Word or LibreOffice format.

Data

+

Export the modified dataset in different formats.

Code

+

See all the code snippets from the different steps in your data +evaluation.

diff --git a/news/index.html b/news/index.html index cadebe3..dca85df 100644 --- a/news/index.html +++ b/news/index.html @@ -39,7 +39,8 @@

FreesearchR 25.4.2

Polished and simplified data import module including a much improved REDCap import module.

FreesearchR 25.4.1

diff --git a/pkgdown.yml b/pkgdown.yml index 40b427b..19056e7 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.1.1 pkgdown_sha: ~ articles: FreesearchR: FreesearchR.html -last_built: 2025-04-10T14:04Z +last_built: 2025-04-11T11:40Z urls: reference: https://agdamsbo.github.io/FreesearchR/reference article: https://agdamsbo.github.io/FreesearchR/articles diff --git a/reference/append_column.html b/reference/append_column.html new file mode 100644 index 0000000..1417f5c --- /dev/null +++ b/reference/append_column.html @@ -0,0 +1,165 @@ + +Append a column to a data.frame — append_column • FreesearchR + Skip to contents + + +
+
+
+ +
+

Append a column to a data.frame

+
+ +
+

Usage

+
append_column(data, column, name, index = "right")
+
+ +
+

Arguments

+ + +
data
+

data

+ + +
column
+

new column (vector) or data.frame with 1 column

+ + +
name
+

new name (pre-fix)

+ + +
index
+

desired location. May be "left", "right" or numeric index.

+ +
+
+

Value

+

data.frame

+
+ +
+

Examples

+
mtcars |>
+  dplyr::mutate(mpg_cut = mpg) |>
+  append_column(mtcars$mpg, "mpg_cutter")
+#>                      mpg cyl  disp  hp drat    wt  qsec vs am gear carb mpg_cut
+#> Mazda RX4           21.0   6 160.0 110 3.90 2.620 16.46  0  1    4    4    21.0
+#> Mazda RX4 Wag       21.0   6 160.0 110 3.90 2.875 17.02  0  1    4    4    21.0
+#> Datsun 710          22.8   4 108.0  93 3.85 2.320 18.61  1  1    4    1    22.8
+#> Hornet 4 Drive      21.4   6 258.0 110 3.08 3.215 19.44  1  0    3    1    21.4
+#> Hornet Sportabout   18.7   8 360.0 175 3.15 3.440 17.02  0  0    3    2    18.7
+#> Valiant             18.1   6 225.0 105 2.76 3.460 20.22  1  0    3    1    18.1
+#> Duster 360          14.3   8 360.0 245 3.21 3.570 15.84  0  0    3    4    14.3
+#> Merc 240D           24.4   4 146.7  62 3.69 3.190 20.00  1  0    4    2    24.4
+#> Merc 230            22.8   4 140.8  95 3.92 3.150 22.90  1  0    4    2    22.8
+#> Merc 280            19.2   6 167.6 123 3.92 3.440 18.30  1  0    4    4    19.2
+#> Merc 280C           17.8   6 167.6 123 3.92 3.440 18.90  1  0    4    4    17.8
+#> Merc 450SE          16.4   8 275.8 180 3.07 4.070 17.40  0  0    3    3    16.4
+#> Merc 450SL          17.3   8 275.8 180 3.07 3.730 17.60  0  0    3    3    17.3
+#> Merc 450SLC         15.2   8 275.8 180 3.07 3.780 18.00  0  0    3    3    15.2
+#> Cadillac Fleetwood  10.4   8 472.0 205 2.93 5.250 17.98  0  0    3    4    10.4
+#> Lincoln Continental 10.4   8 460.0 215 3.00 5.424 17.82  0  0    3    4    10.4
+#> Chrysler Imperial   14.7   8 440.0 230 3.23 5.345 17.42  0  0    3    4    14.7
+#> Fiat 128            32.4   4  78.7  66 4.08 2.200 19.47  1  1    4    1    32.4
+#> Honda Civic         30.4   4  75.7  52 4.93 1.615 18.52  1  1    4    2    30.4
+#> Toyota Corolla      33.9   4  71.1  65 4.22 1.835 19.90  1  1    4    1    33.9
+#> Toyota Corona       21.5   4 120.1  97 3.70 2.465 20.01  1  0    3    1    21.5
+#> Dodge Challenger    15.5   8 318.0 150 2.76 3.520 16.87  0  0    3    2    15.5
+#> AMC Javelin         15.2   8 304.0 150 3.15 3.435 17.30  0  0    3    2    15.2
+#> Camaro Z28          13.3   8 350.0 245 3.73 3.840 15.41  0  0    3    4    13.3
+#> Pontiac Firebird    19.2   8 400.0 175 3.08 3.845 17.05  0  0    3    2    19.2
+#> Fiat X1-9           27.3   4  79.0  66 4.08 1.935 18.90  1  1    4    1    27.3
+#> Porsche 914-2       26.0   4 120.3  91 4.43 2.140 16.70  0  1    5    2    26.0
+#> Lotus Europa        30.4   4  95.1 113 3.77 1.513 16.90  1  1    5    2    30.4
+#> Ford Pantera L      15.8   8 351.0 264 4.22 3.170 14.50  0  1    5    4    15.8
+#> Ferrari Dino        19.7   6 145.0 175 3.62 2.770 15.50  0  1    5    6    19.7
+#> Maserati Bora       15.0   8 301.0 335 3.54 3.570 14.60  0  1    5    8    15.0
+#> Volvo 142E          21.4   4 121.0 109 4.11 2.780 18.60  1  1    4    2    21.4
+#>                     mpg_cutter
+#> Mazda RX4                 21.0
+#> Mazda RX4 Wag             21.0
+#> Datsun 710                22.8
+#> Hornet 4 Drive            21.4
+#> Hornet Sportabout         18.7
+#> Valiant                   18.1
+#> Duster 360                14.3
+#> Merc 240D                 24.4
+#> Merc 230                  22.8
+#> Merc 280                  19.2
+#> Merc 280C                 17.8
+#> Merc 450SE                16.4
+#> Merc 450SL                17.3
+#> Merc 450SLC               15.2
+#> Cadillac Fleetwood        10.4
+#> Lincoln Continental       10.4
+#> Chrysler Imperial         14.7
+#> Fiat 128                  32.4
+#> Honda Civic               30.4
+#> Toyota Corolla            33.9
+#> Toyota Corona             21.5
+#> Dodge Challenger          15.5
+#> AMC Javelin               15.2
+#> Camaro Z28                13.3
+#> Pontiac Firebird          19.2
+#> Fiat X1-9                 27.3
+#> Porsche 914-2             26.0
+#> Lotus Europa              30.4
+#> Ford Pantera L            15.8
+#> Ferrari Dino              19.7
+#> Maserati Bora             15.0
+#> Volvo 142E                21.4
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/cut_var.Date.html b/reference/cut_var.Date.html new file mode 100644 index 0000000..62c61cd --- /dev/null +++ b/reference/cut_var.Date.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/reference/cut_var.POSIXct.html b/reference/cut_var.POSIXct.html new file mode 100644 index 0000000..62c61cd --- /dev/null +++ b/reference/cut_var.POSIXct.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/reference/cut_var.POSIXt.html b/reference/cut_var.POSIXt.html new file mode 100644 index 0000000..62c61cd --- /dev/null +++ b/reference/cut_var.POSIXt.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/reference/cut_var.default.html b/reference/cut_var.default.html new file mode 100644 index 0000000..62c61cd --- /dev/null +++ b/reference/cut_var.default.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/reference/cut_var.hms.html b/reference/cut_var.hms.html new file mode 100644 index 0000000..62c61cd --- /dev/null +++ b/reference/cut_var.hms.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/reference/cut_var.html b/reference/cut_var.html new file mode 100644 index 0000000..b722cec --- /dev/null +++ b/reference/cut_var.html @@ -0,0 +1,170 @@ + +Extended cutting function with fall-back to the native base::cut — cut_var • FreesearchR + Skip to contents + + +
+
+
+ +
+

Extended cutting function with fall-back to the native base::cut

+
+ +
+

Usage

+
cut_var(x, ...)
+
+# Default S3 method
+cut_var(x, ...)
+
+# S3 method for class 'hms'
+cut_var(x, breaks, ...)
+
+# S3 method for class 'POSIXt'
+cut_var(
+  x,
+  breaks,
+  right = FALSE,
+  include.lowest = TRUE,
+  start.on.monday = TRUE,
+  ...
+)
+
+# S3 method for class 'POSIXct'
+cut_var(
+  x,
+  breaks,
+  right = FALSE,
+  include.lowest = TRUE,
+  start.on.monday = TRUE,
+  ...
+)
+
+# S3 method for class 'Date'
+cut_var(x, breaks, start.on.monday = TRUE, ...)
+
+ +
+

Arguments

+ + +
x
+

an object inheriting from class "POSIXct"

+ + +
...
+

passed on

+ +
+
+

Value

+

factor

+
+ +
+

Examples

+
readr::parse_time(c("01:00:20", "03:00:20", "01:20:20", "08:20:20", "21:20:20", "03:02:20")) |> cut_var(2)
+#> [1] 01:00:20 01:00:20 01:00:20 03:01:20 <NA>     03:01:20
+#> attr(,"brks")
+#> 01:00:20
+#> 03:01:20
+#> 21:20:20
+#> Levels: 01:00:20 03:01:20
+readr::parse_time(c("01:00:20", "03:00:20", "01:20:20", "08:20:20", "21:20:20", "03:02:20")) |> cut_var("min")
+#> [1] 01:00:00 03:00:00 01:20:00 08:20:00 21:20:00 03:02:00
+#> attr(,"brks")
+#> 01:00:00
+#> 01:20:00
+#> 03:00:00
+#> 03:02:00
+#> 08:20:00
+#> 21:20:00
+#> 21:20:20
+#> Levels: 01:00:00 01:20:00 03:00:00 03:02:00 08:20:00 21:20:00
+readr::parse_time(c("01:00:20", "03:00:20", "01:20:20", "08:20:20", "21:20:20", "03:02:20")) |> cut_var(breaks = "hour")
+#> [1] 01:00:00 03:00:00 01:00:00 08:00:00 21:00:00 03:00:00
+#> attr(,"brks")
+#> 01:00:00
+#> 03:00:00
+#> 08:00:00
+#> 21:00:00
+#> 21:20:20
+#> Levels: 01:00:00 03:00:00 08:00:00 21:00:00
+readr::parse_time(c("01:00:20", "03:00:20", "01:20:20", "08:20:20", "21:20:20", "03:02:20")) |> cut_var(breaks = hms::as_hms(c("01:00:00", "03:01:20", "9:20:20")))
+#> [1] 01:00:00 01:00:00 01:00:00 03:01:20 <NA>     03:01:20
+#> attr(,"brks")
+#> 01:00:00
+#> 03:01:20
+#> 09:20:20
+#> Levels: 01:00:00 03:01:20
+d_t <- readr::parse_time(c("01:00:20", "03:00:20", "01:20:20", "03:02:20", NA))
+f <- d_t |> cut_var(2)
+readr::parse_time(c("01:00:20", "03:00:20", "01:20:20", "03:02:20", NA)) |> cut_var(breaks = lubridate::as_datetime(c(hms::as_hms(levels(f)), hms::as_hms(max(d_t, na.rm = TRUE) + 1))), right = FALSE)
+#> [1] 01:00:20 02:10:20 01:00:20 02:10:20 <NA>    
+#> attr(,"brks")
+#> 01:00:20
+#> 02:10:20
+#> 03:02:21
+#> Levels: 01:00:20 02:10:20
+readr::parse_datetime(c("1992-02-01 01:00:20", "1992-02-06 03:00:20", "1992-05-01 01:20:20", "1992-09-01 08:20:20", "1999-02-01 21:20:20", "1992-12-01 03:02:20")) |> cut_var(2)
+#> Error in base::cut.default(x, ...): 'x' must be numeric
+readr::parse_datetime(c("1992-02-01 01:00:20", "1992-02-06 03:00:20", "1992-05-01 01:20:20", "1992-09-01 08:20:20", "1999-02-01 21:20:20", "1992-12-01 03:02:20")) |> cut_var(breaks = "weekday")
+#> Error in base::cut.default(x, ...): 'x' must be numeric
+readr::parse_datetime(c("1992-02-01 01:00:20", "1992-02-06 03:00:20", "1992-05-01 01:20:20", "1992-09-01 08:20:20", "1999-02-01 21:20:20", "1992-12-01 03:02:20")) |> cut_var(breaks = "month_only")
+#> Error in base::cut.default(x, ...): 'x' must be numeric
+as.Date(c("1992-02-01 01:00:20", "1992-02-06 03:00:20", "1992-05-01 01:20:20", "1992-09-01 08:20:20", "1999-02-01 21:20:20", "1992-12-01 03:02:20")) |> cut_var(2)
+#> Error in base::cut.default(x, ...): 'x' must be numeric
+as.Date(c("1992-02-01 01:00:20", "1992-02-06 03:00:20", "1992-05-01 01:20:20", "1992-09-01 08:20:20", "1999-02-01 21:20:20", "1992-12-01 03:02:20")) |> cut_var(breaks = "weekday")
+#> Error in base::cut.default(x, ...): 'x' must be numeric
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/default_parsing.html b/reference/default_parsing.html index 7796429..43245ca 100644 --- a/reference/default_parsing.html +++ b/reference/default_parsing.html @@ -88,6 +88,13 @@ #> $ am : logi [1:32] TRUE TRUE TRUE FALSE FALSE FALSE ... #> $ gear: Factor w/ 3 levels "3","4","5": 2 2 2 1 1 1 1 2 2 2 ... #> $ carb: Factor w/ 6 levels "1","2","3","4",..: 4 4 1 1 2 1 4 2 2 4 ... +head(starwars, 5) |> str() +#> Error: object 'starwars' not found +starwars |> + default_parsing() |> + head(5) |> + str() +#> Error: object 'starwars' not found