Skip to contents

Creates new numeric columns by rounding existing numeric columns at specified decimal precisions. This is useful for feature engineering, where different rounding granularities may capture meaningful patterns.

Usage

plant_decimals_round(barn_obj, numeric_sufix = "_num", precisions = c(9, 8))

Arguments

barn_obj

A barn object, created by barn().

numeric_sufix

The suffix used to identify numeric columns to process. Defaults to "_num".

precisions

A numeric vector specifying the number of decimal places to round to (e.g., c(9, 8)).

Value

The modified barn_obj with the transformed combined data frame.

Examples

df <- tibble::tibble(x_num = c(1.23456789))
b <- barn(df) |> plant_decimals_round(precisions = c(2, 3))
harvest(b)[[1]]
#> # A tibble: 1 × 3
#>   x_num x_r2_num x_r3_num
#>   <dbl>    <dbl>    <dbl>
#> 1  1.23     1.23     1.24
harvest(b)[[1]]$x_r2_num
#> [1] 1.23
harvest(b)[[1]]$x_r3_num
#> [1] 1.235