stop_ds_difference {imputeGeneric} | R Documentation |
Compare differences between two data sets
Description
This function is intended to be used as stop_fun
inside of
impute_iterative()
. It compares the difference of two (numeric) data sets
and return ds
, if difference is small enough (less than stop_args$eps
).
Usage
stop_ds_difference(
ds,
ds_old,
info_list,
stop_args = list(eps = 1e-06, p = 1, sum_diffs = TRUE, na_rm = TRUE),
res_stop_fun = NULL
)
Arguments
ds |
A numeric data set |
ds_old |
A numeric data set |
info_list |
|
stop_args |
A list with following named components (missing elements will be replaced by default ones):
|
res_stop_fun |
Only needed to be a valid stop function. Internally, this argument is ignored at the moment. |
Value
list(stop_iter = FALSE)
, if the difference is too big. Otherwise
ds
with number of iterations (nr_iterations
) as attribute.
Examples
set.seed(123)
ds1 <- data.frame(X = rnorm(10), Y = rnorm(10))
ds2 <- data.frame(X = rnorm(10), Y = rnorm(10))
all.equal(
stop_ds_difference(ds1, ds1, list(nr_iterations = 3)),
structure(ds1, nr_iterations = 3)
)
stop_ds_difference(ds1, ds2, list(nr_iterations = 42))