Skip to contents

Check the spacing of a variable

Usage

step_compare_columns(
  .rec,
  data,
  compare,
  role = "add",
  n_sd = 4,
  na_rm = TRUE,
  ...
)

Arguments

.rec

the R6 recipe object.

data

variable unquoted data column name

compare

variable unquoted column name for comparison

role

character - the name of the role

n_sd

numeric - number of standard deviations for the scaling

na_rm

logical - should NA values be removed from calculations

...

additional arguments

Value

an updated recipe

Examples


data("kennel_2020")

kennel_2020[1e4, wl := 13.36]
#>                   datetime     baro       wl       et
#>                     <POSc>    <num>    <num>    <num>
#>     1: 2016-08-18 00:00:00 9.450323 13.31938 269.3297
#>     2: 2016-08-18 00:01:00 9.449909 13.31864 276.6653
#>     3: 2016-08-18 00:02:00 9.450103 13.31875 283.9697
#>     4: 2016-08-18 00:03:00 9.450135 13.31891 291.2427
#>     5: 2016-08-18 00:04:00 9.450521 13.31888 298.4836
#>    ---                                               
#> 81357: 2016-10-13 11:56:00 9.498389 13.18380 685.3137
#> 81358: 2016-10-13 11:57:00 9.498701 13.18382 685.0776
#> 81359: 2016-10-13 11:58:00 9.498266 13.18339 684.7894
#> 81360: 2016-10-13 11:59:00 9.498545 13.18312 684.4491
#> 81361: 2016-10-13 12:00:00 9.498260 13.18315 684.0567

frec = recipe(wl~baro, data = kennel_2020) |>
 step_compare_columns(data = wl, compare = baro, n_sd = 15) |>
 prep() |>
 bake()