Description Usage Arguments Value References See Also Examples
Apply k-nearest neighbor (KNN) imputation to a matrix or poplin object. This is an interface to the kNN function from the VIM package. Since it is based on Gower's distance, Standardization of input data before imputation would not affect the result.
1 2 3 4 5 | ## S4 method for signature 'matrix'
impute_knn(x, by = c("feature", "sample"), ...)
## S4 method for signature 'poplin'
impute_knn(x, xin, xout, by = c("feature", "sample"), ...)
|
x |
A matrix or poplin object. |
by |
Character controlling whether the imputation is performed by k-nearest features or by k-nearest samples. Either "feature" or "sample". |
... |
Additional arguments passed to kNN. |
xin |
Character specifying the name of data to retrieve from |
xout |
Character specifying the name of data to store in |
A matrix or poplin object of the same dimension as
x
containing the imputed intensities.
Alexander Kowarik, Matthias Templ (2016). Imputation with the R Package VIM. Journal of Statistical Software, 74(7), 1-16. doi:10.18637/jss.v074.i07
Gower, J. C. (1971). A General Coefficient of Similarity and Some of Its Properties. Biometrics, 27(4), 857–871. https://doi.org/10.2307/2528823
Other imputation methods:
impute_pca()
,
impute_randomforest()
,
impute_univariate()
,
poplin_impute()
1 2 3 4 5 6 7 8 9 10 | data(faahko_poplin)
if (requireNamespace("VIM", quietly = TRUE)) {
## poplin object
impute_knn(faahko_poplin, xin = "raw", xout = "knn")
## matrix
m <- poplin_raw(faahko_poplin, "raw")
impute_knn(m)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.