Hi,

I'm trying to export the log normalized count data from Seurat in to a .csv file and get the following error:

    library (Seurat)
    fib.data <- subset(onlyharmonfib, subset = nFeature_RNA > 200 & nFeature_RNA < 2500 & percent.mito <5)
    fib.data_norm<- NormalizeData(fib.data)
    fib_count <- GetAssayData(object = fib.data_norm, assay = "RNA", slot = "data")
    write.csv(as.matrix(fib_count), file = "file_path", quote = FALSE)

    Error in file(file, ifelse(append, "a", "w")) : cannot open the connection

Is there an easier method to get the data in a .csv file?

Thank you for your help!


I would use the `data.table` library to write the file, otherwise it could take a while to write to disk.

    library("data.table")
    
    fwrite(as.data.table(fib_count, keep.rownames="feature"), "counts.csv")