diff --git a/404.html b/404.html index 1142c848..9cbdc508 100644 --- a/404.html +++ b/404.html @@ -23,7 +23,7 @@ FreesearchR - 25.4.2 + 25.4.1 - - - - - -
-
-
- -
-

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/append_list.html b/reference/append_list.html index 450dcc28..ab6b2302 100644 --- a/reference/append_list.html +++ b/reference/append_list.html @@ -7,7 +7,7 @@ FreesearchR - 25.4.2 + 25.4.1 - - - - - -
-
-
- -
-

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/data-correlations.html b/reference/data-correlations.html index 8852277b..f13d8fbe 100644 --- a/reference/data-correlations.html +++ b/reference/data-correlations.html @@ -7,7 +7,7 @@ FreesearchR - 25.4.2 + 25.4.1 - - - - - -
-
-
- -
-

Reduce character vector with the native pipe operator or character string

-
- -
-

Usage

-
pipe_string(data, collapse = "|>\n")
-
- -
-

Arguments

- - -
data
-

list

- -
-
-

Value

-

character string

-
- -
-

Examples

-
list(
-  "mtcars",
-  rlang::call2(.fn = "select", !!!list(c("cyl", "disp")), .ns = "dplyr"),
-  rlang::call2(.fn = "default_parsing", .ns = "FreesearchR")
-) |>
-  lapply(expression_string) |>
-  pipe_string() |>
-  expression_string("data<-")
-#> [1] "data<-mtcars|>\ndplyr::select(c('cyl','disp'))|>\nFreesearchR::default_parsing()"
-
-
-
- - -
- - - -
- - - - - - - diff --git a/reference/plot.tbl_regression.html b/reference/plot.tbl_regression.html index 40f917b4..bb1e62fd 100644 --- a/reference/plot.tbl_regression.html +++ b/reference/plot.tbl_regression.html @@ -7,7 +7,7 @@ FreesearchR - 25.4.2 + 25.4.1 - - - - - -
-
-
- -
-

Remove empty/NA attributes

-
- -
-

Usage

-
remove_empty_attr(data)
-
- -
-

Arguments

- - -
data
-

data

- -
-
-

Value

-

data of same class as input

-
- -
- - -
- - - -
- - - - - - - diff --git a/reference/remove_empty_cols.html b/reference/remove_empty_cols.html index 173758d0..2086299a 100644 --- a/reference/remove_empty_cols.html +++ b/reference/remove_empty_cols.html @@ -7,7 +7,7 @@ FreesearchR - 25.4.2 + 25.4.1 - - - - - -
-
-
- -
-

Very simple function to remove nested lists, lik ewhen uploading .rds

-
- -
-

Usage

-
remove_nested_list(data)
-
- -
-

Arguments

- - -
data
-

data

- -
-
-

Value

-

data.frame

-
- -
-

Examples

-
dplyr::tibble(a = 1:10, b = rep(list("a"), 10)) |> remove_nested_list()
-#> # A tibble: 10 × 1
-#>        a
-#>    <int>
-#>  1     1
-#>  2     2
-#>  3     3
-#>  4     4
-#>  5     5
-#>  6     6
-#>  7     7
-#>  8     8
-#>  9     9
-#> 10    10
-dplyr::tibble(a = 1:10, b = rep(list(c("a", "b")), 10)) |> as.data.frame()
-#>     a    b
-#> 1   1 a, b
-#> 2   2 a, b
-#> 3   3 a, b
-#> 4   4 a, b
-#> 5   5 a, b
-#> 6   6 a, b
-#> 7   7 a, b
-#> 8   8 a, b
-#> 9   9 a, b
-#> 10 10 a, b
-
-
-
- - -
- - - -
- - - - - - - diff --git a/reference/repeated_instruments.html b/reference/repeated_instruments.html index aef3c1fe..82f1349c 100644 --- a/reference/repeated_instruments.html +++ b/reference/repeated_instruments.html @@ -7,7 +7,7 @@ FreesearchR - 25.4.2 + 25.4.1 - - - - - -
-
-
- -
-

(Re)label columns in data.frame

-
- -
-

Usage

-
set_column_label(data, label, overwrite = TRUE)
-
- -
-

Arguments

- - -
data
-

data.frame to be labelled

- - -
label
-

named list or vector

- -
-
-

Value

-

data.frame

-
- -
-

Examples

-
ls <- list("mpg" = "", "cyl" = "Cylinders", "disp" = "", "hp" = "", "drat" = "", "wt" = "", "qsec" = "", "vs" = "", "am" = "", "gear" = "", "carb" = "")
-ls2 <- c("mpg" = "", "cyl" = "Cylinders", "disp" = "", "hp" = "Horses", "drat" = "", "wt" = "", "qsec" = "", "vs" = "", "am" = "", "gear" = "", "carb" = "")
-ls3 <- c("mpg" = "", "cyl" = "", "disp" = "", "hp" = "Horses", "drat" = "", "wt" = "", "qsec" = "", "vs" = "", "am" = "", "gear" = "", "carb" = "")
-mtcars |>
-  set_column_label(ls) |>
-  set_column_label(ls2) |>
-  set_column_label(ls3)
-#> # A tibble: 32 × 11
-#>      mpg   cyl  disp    hp  drat    wt  qsec    vs    am  gear  carb
-#>    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
-#>  1  21       6  160    110  3.9   2.62  16.5     0     1     4     4
-#>  2  21       6  160    110  3.9   2.88  17.0     0     1     4     4
-#>  3  22.8     4  108     93  3.85  2.32  18.6     1     1     4     1
-#>  4  21.4     6  258    110  3.08  3.22  19.4     1     0     3     1
-#>  5  18.7     8  360    175  3.15  3.44  17.0     0     0     3     2
-#>  6  18.1     6  225    105  2.76  3.46  20.2     1     0     3     1
-#>  7  14.3     8  360    245  3.21  3.57  15.8     0     0     3     4
-#>  8  24.4     4  147.    62  3.69  3.19  20       1     0     4     2
-#>  9  22.8     4  141.    95  3.92  3.15  22.9     1     0     4     2
-#> 10  19.2     6  168.   123  3.92  3.44  18.3     1     0     4     4
-#> # ℹ 22 more rows
-rlang::expr(FreesearchR::set_column_label(label = !!ls3)) |> expression_string()
-#> [1] "FreesearchR::set_column_label(label=c(mpg='',cyl='',disp='',hp='Horses',drat='',wt='',qsec='',vs='',am='',gear='',carb=''))"
-
-
-
- - -
- - - -
- - - - - - - diff --git a/reference/sort_by.html b/reference/sort_by.html index eae0f82e..7f7aa2d3 100644 --- a/reference/sort_by.html +++ b/reference/sort_by.html @@ -7,7 +7,7 @@ FreesearchR - 25.4.2 + 25.4.1