使用 imp4p 包 impute.slsa 函数的缺失值插补错误:fast_apply_sd_na_rm_T(xincomplete1, 1) 中的错误:不是矩阵

Error in missing value imputation using imp4p package, impute.slsa function: Error in fast_apply_sd_na_rm_T(xincomplete1, 1) : Not a matrix

对于上下文,我想估算蛋白质组数据集中的缺失值(蛋白质水平,而不是肽),我正在尝试使用函数 impute.mix,这需要使用 impute.slsa函数,在imp4p包中。
https://cran.r-project.org/web/packages/imp4p/imp4p.pdf

实验设计信息:
- 我有 1 个生物复制
- 4 种细胞类型(生物样本)
- 对于这些细胞类型中的每一种,我都有 3 个技术重复

这给了我 12 列样本和 3000 多行观察结果。

这是我 运行 遇到问题的地方

library(imp4p)

df <- data.frame(
  Cell_1 = c(NA, 8.367031, NA, 7.279088, 5.649025),
  Cell_2 = c(4.660856, 8.450544, 6.984861, NA, NA),
  Cell_3 = c(NA, 7.829102, NA, 8.434507, NA),
  Cell_4 = c(NA, 8.471086, NA, 10.028531, 9.175705),
  Cell_5 = c(5.30285, 9.60319, 8.51769, NA, NA)
)

data <- as.matrix(df)
cdts <- c("MK", "MK", "Plts", "Plts", "RBC")

Tab_imp <- impute.slsa(data, conditions=cdts, repbio=NULL, reptech=NULL, nknn=15, selec="all", weight=1, ind.comp=1, progress.bar=TRUE)

我认为 imp4p 包是最新的,所以我没能找到接近我得到的错误。谁能给我一条正确的道路?

会话信息

R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252   
[3] LC_MONETARY=French_France.1252 LC_NUMERIC=C                  
[5] LC_TIME=French_France.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] imp4p_0.8       norm_1.0-9.5    truncnorm_1.0-8 Iso_0.0-18     

loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1    yaml_2.2.0     Rcpp_1.0.3     knitr_1.26     xfun_0.11  

错误是函数采用的第二个参数应该是因子而不是向量,因此只需将其转换为因子就可以了;

library(imp4p)

# Create a dataframe
df <- data.frame(
  Cell_1 = c(NA, 8.367031, NA, 7.279088, 5.649025),
  Cell_2 = c(4.660856, 8.450544, 6.984861, NA, NA),
  Cell_3 = c(NA, 7.829102, NA, 8.434507, NA),
  Cell_4 = c(NA, 8.471086, NA, 10.028531, 9.175705),
  Cell_5 = c(5.30285, 9.60319, 8.51769, NA, NA)
)

# Convert dataframe into a matrix
data <- as.matrix(df)
# Create a factor of of biological conditions
cdts <- factor(c("MK", "MK", "Plts", "Plts", "RBC"))

# Impute missing values using adaption of LSimpute algorithm.
Tab_imp <- impute.slsa(data, conditions = cdts, repbio = NULL, reptech = NULL, 
                       nknn = 15, selec = "all", weight = 1, ind.comp = 1, progress.bar = TRUE)