reduce_cluster()
and map_cluster()
apply the data reduction to the targets
found in the director step. They only do so if the metric is above the
threshold, however. reduce_cluster()
is for functions that return vectors
while map_cluster()
is for functions that return data.frames
. If you're
using as_reducer()
, there's no need to call these functions directly.
reduce_cluster(.partition_step, .f, first_match = FALSE)
map_cluster(.partition_step, .f, rewind = FALSE, first_match = FALSE)
a partition_step
object
a function to reduce the data to either a vector or a data.frame
logical. Should the partition algorithm stop when it finds
a reduction that is equal to the threshold? Default is TRUE
for reducers
that return a data.frame
and FALSE
for reducers that return a vector
logical. Should the last target be used instead of the current target?
a partition_step
object
reduce_row_means <- function(.partition_step, .data) {
reduce_cluster(.partition_step, rowMeans)
}
replace_partitioner(
part_icc,
reduce = reduce_row_means
)
#> Director: Minimum Distance (Pearson)
#> Metric: Intraclass Correlation
#> Reducer: <custom reducer>