执行以下代码时出现的报错:
.calcFactorQuantile <- function (data, lib.size, p=0.75)
#Generalized version of upper-quartile normalization
{
f <- rep_len(1,ncol(data))
for (j in seq_len(ncol(data))) f[j] <- quantile(data[,j], probs=p)
if(min(f)==0) warning("One or more quantiles are zero")
f / lib.size
}
f75 <- suppressWarnings(.calcFactorQuantile(data=x, lib.size=lib.size, p=0.75))
解决方案:在quantile
函数加上na.rm=TRUE
参数
.calcFactorQuantile <- function (data, lib.size, p=0.75)
#Generalized version of upper-quartile normalization
{
f <- rep_len(1,ncol(data))
for (j in seq_len(ncol(data))) f[j] <- quantile(data[,j], probs=p,na.rm=TRUE)
if(min(f)==0) warning("One or more quantiles are zero")
f / lib.size
}
f75 <- suppressWarnings(.calcFactorQuantile(data=x, lib.size=lib.size, p=0.75))