Entering edit mode
sambunga094
•
0
@sambunga094-21466
Last seen 5.4 years ago
Hi, I have a gene counts table which something looks like this:
When i'm trying to convert this into a matrix im getting this following error:
Error in asMethod(object) :
Cholmod error 'problem too large' at file ../Core/cholmod_dense.c, line 105`
This is the code that i'm using which i borrowed from a tutorial online:
library(Matrix)
library(data.table)
f<-as.data.frame(fread(file="Z:/sc_wizard/data.counts",h=T,sep='\t'))
sm = sparseMatrix(as.numeric(factor(f$gene)), as.numeric(factor(f$cell)), x=f$count)
rownames(sm)<-levels(factor(f$gene))
colnames(sm)<-levels(factor(f$cell))
write.table(as.matrix(sm),file = "out.tsv",sep='\t',col.names=T,row.names=T,quote=F)`
Help is really appreciated. Thank you!!