What does str(head(datExpr[,1:5]) show? Also, you're reading into DatExpr and using datExpr in the next line. Is that a typo or are they 2 different objects?
From your screenshot, I thought the gene IDs were rownames but you have them as a non-numeric column, which makes the error kinda obvious, don't you think?
Use as.matrix on the dataframe after excluding the first column.
This is count data; so I would strongly recommend filtering it for low counts and normalizing it with limma
expr <- matrix(as.integer(your.df), nrow=nrow(your.df))
rownames(expr) <- rownames(your.df)
colnames(expr) <- colnames(your.df)
med.cnt <- apply(expr, 1, median)
expr.vm <- limma::voom(expr)$E
expr.vm <- expr.vm[med.cnt > 5,] # or so -- see how many genes there are and how stable your results are
expr.for.wgcna <- t(expr.vm) # WGCNA expects genes to be columns
> expr <- matrix(as.integer(DatExpr), nrow=nrow(DatExpr))
Error in matrix(as.integer(DatExpr), nrow = nrow(DatExpr)) :
'list' object cannot be coerced to type 'integer'
Show us your code and tell us what you've tried. Googling the error message should be enough to solve this problem.
What does
str(head(datExpr[,1:5])
show? Also, you're reading intoDatExpr
and usingdatExpr
in the next line. Is that a typo or are they 2 different objects?it is a typo.
From your screenshot, I thought the gene IDs were rownames but you have them as a non-numeric column, which makes the error kinda obvious, don't you think?
Use
as.matrix
on the dataframe after excluding the first column.