今天用pRRophetic R包时发现不能用了,出现Error in if (class(testExprData) != "matrix") stop("ERROR: \"testExprData\" must be a matrix.") : the condition has length > 1的报错。经检查发现在较新的R版本(=4.3.0)下class(matrix)会返回"matrix"和"array"两个属性,而在老版本的R(=3.6.1)只会返回"matrix"
这种情况使用老版本R就可以了,但是我懒......直接改源码吧:
源码里有几处对class的判断,用trace改一下就可以了
library(pRRophetic)
trace(calcPhenotype, edit = T)
在calcPhenotype函数的第6,8,10,12和66行class函数后面加个[1]
接上
还有summarizeGenesByMean函数的第19行,trace(summarizeGenesByMean, edit = T)
搞定