Learn R Programming

metamorphr (version 0.2.0)

impute_svd: Impute missing values using Singular Value Decomposition (SVD)

Description

Basically a wrapper around pcaMethods::pca(method = "svdImpute"). For a detailed discussion, see the vignette("pcaMethods") and vignette("missingValues", "pcaMethods") as well as the References section.

Important Note impute_svd() depends on the pcaMethods package from Bioconductor. If metamorphr was installed via install.packages(), dependencies from Bioconductor were not automatically installed. When impute_svd() is called without the pcaMethods package installed, you should be asked if you want to install pak and pcaMethods. If you want to use impute_svd() you have to install those. In case you run into trouble with the automatic installation, please install pcaMethods manually. See pcaMethods – a Bioconductor package providing PCA methods for incomplete data for instructions on manual installation.

Usage

impute_svd(data, n_pcs = 2, center = TRUE, scale = "none", direction = 2)

Value

A tibble with imputed missing values.

Arguments

data

A tidy tibble created by read_featuretable.

n_pcs

The number of PCs to calculate.

center

Should data be mean centered? See prep for details.

scale

Should data be scaled? See prep for details.

direction

Either 1 or 2. 1 runs pcaMethods::pca(method = "svdImpute") on a matrix with samples in columns and features in rows and 2 runs pcaMethods::pca(method = "svdImpute") on a matrix with features in columns and samples in rows. Both are valid according to this discussion on GitHub but give different results.

References

  • H. R. Wolfram Stacklies, 2017, DOI 10.18129/B9.BIOC.PCAMETHODS.

  • W. Stacklies, H. Redestig, M. Scholz, D. Walther, J. Selbig, Bioinformatics 2007, 23, 1164–1167, DOI 10.1093/bioinformatics/btm069.

  • O. Troyanskaya, M. Cantor, G. Sherlock, P. Brown, T. Hastie, R. Tibshirani, D. Botstein, R. B. Altman, Bioinformatics 2001, 17, 520–525, DOI 10.1093/bioinformatics/17.6.520.

Examples

Run this code
toy_metaboscape %>%
  impute_svd()

Run the code above in your browser using DataLab