Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
filter <- apply(expressionMatrix, 2, function (x) (colIQRs(x, na.rm = TRUE) < 1.6))
“参数 x 是数字类,应该是一个矩阵”错误被抛出。如何应对?我认为逻辑上这段代码是正确的:我删除了所有 IQR 值小于 1.6 的列。
如何在技术上编码?
包中的 colIQRsmatrixStats需要一个矩阵作为输入。但是通过将它包装在一个apply语句中,你一次只给它一个列向量。解决方案是将整个矩阵发送到 colIQRs,然后对结果进行子集处理:
matrixStats
apply
filter <- expressionMatrix[, colIQRs(expressionMatrix, na.rm = TRUE) < 1.6]