Learn R Programming

metamorphr (version 0.2.0)

impute_knn: Impute missing values using nearest neighbor averaging

Description

Basically a wrapper function around impute::impute.knn. Imputes missing values using the k-th nearest neighbor algorithm.

Note that the function ln-transforms the data prior to imputation and transforms it back to the original scale afterwards. Please do not do it manually prior to calling impute_knn()! See References for more information.

Important Note

impute_knn() depends on the impute package from Bioconductor. If metamorphr was installed via install.packages(), dependencies from Bioconductor were not automatically installed. When impute_knn() is called without the impute package installed, you should be asked if you want to install pak and impute. If you want to use impute_knn() you have to install those. In case you run into trouble with the automatic installation, please install impute manually. See impute: Imputation for microarray data for instructions on manual installation.

Usage

impute_knn(data, quietly = TRUE, ...)

Value

A tibble with imputed missing values.

Arguments

data

A tidy tibble created by read_featuretable.

quietly

TRUE or FALSE. Should messages and warnings from impute.knn be printed to the console?

...

Additional parameters passed to impute.knn.

References

  • Robert Tibshirani, Trevor Hastie, 2017, DOI 10.18129/B9.BIOC.IMPUTE.

  • J. Khan, J. S. Wei, M. Ringnér, L. H. Saal, M. Ladanyi, F. Westermann, F. Berthold, M. Schwab, C. R. Antonescu, C. Peterson, P. S. Meltzer, Nat Med 2001, 7, 673–679, DOI 10.1038/89044.

Examples

Run this code
toy_metaboscape %>%
  impute_knn()

Run the code above in your browser using DataLab