as_partition_step()
creates a partition_step
object. partition_step
s
are used while iterating through the partition algorithm: it stores necessary
information about how to proceed in the partitioning, such as the information
threshold. as_partition_step()
is primarily called internally by
partition()
but can be helpful while developing partitioners
.
as_partition_step(
.x,
threshold = NA,
reduced_data = NA,
target = NA,
metric = NA,
tolerance = 0.01,
var_prefix = NA,
partitioner = NA,
...
)
a data.frame
or partition_step
object
The minimum information loss allowable
A data set with reduced variables
A character or integer vector: the variables to reduce
A measure of information
A tolerance around the threshold to accept a reduction
Variable name for reduced variables
A partitioner
, a part_*()
function or one created with
as_partitioner()
.
Other objects to store during the partition step
a partition_step
object
.df <- data.frame(x = rnorm(100), y = rnorm(100))
as_partition_step(.df, threshold = .6)
#> $.df
#> x y
#> 1 -1.400043517 -0.38721358
#> 2 0.255317055 -0.78543266
#> 3 -2.437263611 -1.05673687
#> 4 -0.005571287 -0.79554143
#> 5 0.621552721 -1.75627543
#> 6 1.148411606 -0.69053790
#> 7 -1.821817661 -0.55854199
#> 8 -0.247325302 -0.53666333
#> 9 -0.244199607 0.22712713
#> 10 -0.282705449 0.97845492
#> 11 -0.553699384 -0.20888265
#> 12 0.628982042 -1.39941046
#> 13 2.065024895 0.25853729
#> 14 -1.630989402 -0.44179945
#> 15 0.512426950 0.56859986
#> 16 -1.863011492 2.12685046
#> 17 -0.522012515 0.42485844
#> 18 -0.052601910 -1.68428153
#> 19 0.542996343 0.24940178
#> 20 -0.914074827 1.07283825
#> 21 0.468154420 2.03936926
#> 22 0.362951256 0.44945378
#> 23 -1.304543545 1.39181405
#> 24 0.737776321 0.42656655
#> 25 1.888504929 0.10758399
#> 26 -0.097445104 0.02229473
#> 27 -0.935847354 0.60361101
#> 28 -0.015950311 -0.26265057
#> 29 -0.826788954 -0.52826408
#> 30 -1.512399651 0.19214942
#> 31 0.935363190 -1.14619967
#> 32 0.176488611 0.84618466
#> 33 0.243685465 0.08171963
#> 34 1.623548883 -1.30511701
#> 35 0.112038083 -0.94491206
#> 36 -0.133997013 0.45434159
#> 37 -1.910087468 -0.85520250
#> 38 -0.279237242 -0.28689522
#> 39 -0.313445978 0.89496163
#> 40 1.067307879 0.06730444
#> 41 0.070034850 -0.16267634
#> 42 -0.639123324 -0.82731017
#> 43 -0.049964899 1.87650562
#> 44 -0.251483443 0.76644020
#> 45 0.444797116 0.97995670
#> 46 2.755417575 1.32178099
#> 47 0.046531380 -1.11971083
#> 48 0.577709069 0.51459982
#> 49 0.118194874 -1.50909984
#> 50 -1.911720491 1.53274148
#> 51 0.862086482 0.42914737
#> 52 -0.243236740 0.12210341
#> 53 -0.206087195 -1.13801240
#> 54 0.019177592 -0.55801513
#> 55 0.029560754 1.05253854
#> 56 0.549827542 0.67768364
#> 57 -2.274114857 0.03849955
#> 58 2.682557184 -0.35638119
#> 59 -0.361221255 0.78284410
#> 60 0.213355750 0.80441162
#> 61 1.074345882 -1.90006082
#> 62 -0.665088249 0.93578429
#> 63 1.113952419 -0.30905150
#> 64 -0.245896412 0.26306668
#> 65 -1.177563309 -1.79059186
#> 66 -0.975850616 -0.78825884
#> 67 1.065057320 -1.13302167
#> 68 0.131670635 0.36365257
#> 69 0.488628809 -0.28588791
#> 70 -1.699450568 0.51766913
#> 71 -1.470736306 -0.10290867
#> 72 0.284150344 -0.97406959
#> 73 1.337320413 1.27067230
#> 74 0.236696283 0.96086479
#> 75 1.318293384 0.76872137
#> 76 0.523909788 1.03593077
#> 77 0.606748047 -0.47388707
#> 78 -0.109935672 -1.27533487
#> 79 0.172181715 -0.30562067
#> 80 -0.090327287 2.21176949
#> 81 1.924343341 -1.04166838
#> 82 1.298392759 -1.14652385
#> 83 0.748791268 -1.67532730
#> 84 0.556224329 1.52593866
#> 85 -0.548257264 0.55418551
#> 86 1.110534893 1.99311026
#> 87 -2.612334333 -0.15412074
#> 88 -0.155693776 2.56440834
#> 89 0.433889790 1.06199914
#> 90 -0.381951112 1.14269488
#> 91 0.424187575 1.12383884
#> 92 1.063101996 -0.39700149
#> 93 1.048712620 -0.82326115
#> 94 -0.038102895 -0.57888462
#> 95 0.486148920 1.76378938
#> 96 1.672882611 0.13299215
#> 97 -0.354361164 0.37649933
#> 98 0.946347886 1.13870765
#> 99 1.316826356 1.24126308
#> 100 -0.296640025 0.61209094
#>
#> $threshold
#> [1] 0.6
#>
#> $target
#> [1] NA
#>
#> $last_target
#> [1] NA
#>
#> $reduced_data
#> # A tibble: 100 × 2
#> x y
#> <dbl> <dbl>
#> 1 -1.40 -0.387
#> 2 0.255 -0.785
#> 3 -2.44 -1.06
#> 4 -0.00557 -0.796
#> 5 0.622 -1.76
#> 6 1.15 -0.691
#> 7 -1.82 -0.559
#> 8 -0.247 -0.537
#> 9 -0.244 0.227
#> 10 -0.283 0.978
#> # ℹ 90 more rows
#>
#> $metric
#> [1] NA
#>
#> $tolerance
#> [1] 0.01
#>
#> $mapping_key
#> # A tibble: 2 × 3
#> variable mapping information
#> <chr> <list> <dbl>
#> 1 x <chr [1]> 1
#> 2 y <chr [1]> 1
#>
#> $var_prefix
#> [1] NA
#>
#> $all_done
#> [1] FALSE
#>
#> $partitioner
#> [1] NA
#>
#> attr(,"class")
#> [1] "partition_step"