View source: R/mv_imputation.R
mv_imputation  R Documentation 
Missing values in metabolomics data sets occur widely and can originate from
a number of sources, including technical and biological reasons.
Missing values imputation is applied to replace nonexisting values
with an estimated values while maintaining the data structure. A number of
different methods are available as part of this function.
mv_imputation(
df,
method,
k = 10,
rowmax = 0.5,
colmax = 0.5,
maxp = NULL,
check_df = TRUE
)
df 
A matrixlike (e.g. an ordinary matrix, a data frame) or
RangedSummarizedExperimentclass object with
all values of class 
method 

k 

rowmax 

colmax 

maxp 

check_df 

Supported missing value imputation methods are:
knn
 Knearest neighbour. For each feature in each sample, missing
values are replaced by the mean average value (nonweighted) calculated
from its k
closest neighbours in multivariate space (default distance
metric: euclidean distance);
rf
 Random Forest. This method is a wrapper of
missForest function. For each feature, missing values are
iteratively imputed until a maximum number of iterations (10), or until the
difference between consecutivelyimputed matrices becomes positive.
Trees per forest are set to 100, variables included per tree are calculate
using formula sqrt(total number of variables)
;
bpca
 Bayesian principal component analysis. This method is a
wrapper of pca function. Missing values are replaced by
the values obtained from principal component analysis regression with a
Bayesian method. Therefore every imputed missing value does not occur
multiple times, neither across the samples nor across the metabolite
features;
sv
 Small value. For each feature, replace missing values with half
of the lowest value recorded in the entire data matrix;
'mn'
 Mean. For each feature, replace missing values with the mean
average (nonweighted) of all other nonmissing values for that variable;
'md'
 Median. For each feature, replace missing values with the
median of all other nonmissing values for that variable.
Object of class SummarizedExperiment
. If input data are a
matrixlike (e.g. an ordinary matrix, a data frame) object, function returns
the same R data structure as input with all value of data type
numeric()
.
df < MTBLS79[ ,MTBLS79$Batch == 1]
out < mv_imputation(df=df, method='knn')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.