Error in rowMeans(y$exprs, na.rm = TRUE) : 'x' must be numeric
1
0
Entering edit mode
keervanik • 0
@e2b75c6e
Last seen 2.2 years ago
India

I am getting this error- "x must be numeric" when running this code. I am working on a pre processed data. The data frame is list.

#moderated t test using limma
file <- rma # Column 1 contains row-names
group <- rep(0:1, c(3,5))
library (limma)
lmFit(object, design=NULL, ndups=1, spacing=1, block=NULL, correlation, weights=NULL, method="ls", ...)
fit <- lmFit(file[-10, -1], design=group)
fit2 <- eBayes(fit)
toptableOut<- topTable(fit2, number=Inf, adjust.method="BH")$t
topTable(fit2, coef = 1, number = Inf, confint = TRUE, sort.by = "none")[,-4]
x <- cbind(file[,1],toptableOut)
write.table(x,"<filename>.txt", quote=F, row.names=FALSE, sep="\t")
limma • 1.6k views
ADD COMMENT
1
Entering edit mode
@james-w-macdonald-5106
Last seen 1 hour ago
United States

You will need to provide more information than that. Simply providing code without context makes it impossible for anybody to help you. But if I were to take a wild guess, I imagine that your rma or file object (both bad names btw, as those are both function names as well) is a matrix, in which case everything is character since the first column contains the row names. As a simple example,

> mat <- cbind(letters, 1:26, 1:26, 1:26)
> library(limma)
> lmFit(mat[,-1])
Error in rowMeans(y$exprs, na.rm = TRUE) : 'x' must be numeric

But without more information this is just a guess. You need to provide the head of your file object, your design matrix, and the output from sessionInfo at the very least.

ADD COMMENT

Login before adding your answer.

Traffic: 787 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6