Skip to contents

Impute the missing values in the peak table of the object using a random forest. The estimated error in the imputation is logged. It is recommended to set the seed number for reproducibility (it is called random forest for a reason). This a wrapper around missForest. Use parallelize = "variables" to run in parallel for faster testing. NOTE: running in parallel prevents user from setting a seed number.

Usage

impute_rf(object, all_features = FALSE, assay.type = NULL, name = NULL, ...)

Arguments

object

a SummarizedExperiment or MetaboSet object

all_features

logical, should all features be used? If FALSE (the default), flagged features are removed before imputation.

assay.type

character, assay to be used in case of multiple assays

name

character, name of the resultant assay in case of multiple assays

...

passed to missForest

Value

An object as the one supplied, with missing values imputed.

See also

missForest for detail about the algorithm and the parameters

Examples

data(example_set)
missing <- mark_nas(example_set, 0)
set.seed(38)
imputed <- impute_rf(missing)
#> INFO [2025-06-23 22:36:38] 
#> Starting random forest imputation at 2025-06-23 22:36:38.315989
#> INFO [2025-06-23 22:36:41] Out-of-bag error in random forest imputation: 0.467
#> INFO [2025-06-23 22:36:41] Random forest imputation finished at 2025-06-23 22:36:41.965843 
#>