Off topic:Error in as.vector(x) : no method for coercing this S4 class to a vector
1
0
Entering edit mode
5.2 years ago
pr2009 ▴ 10

I tried to run the following code in R studio. Everything worked fine, except at the last step [write.table(mdat, "recount_mdat.csv")] when I tried to export the 'mdat', I got the following error:

 Error in as.vector(x) : no method for coercing this S4 class to a vector

My code

 library('dplyr')
 library('recount')
 library('magrittr')
 library('ffpe')
 library('RSkittleBrewer')
 library('SummarizedExperiment')
 library('devtools')
 trop <- RSkittleBrewer::RSkittleBrewer('tropical')
 colon_proj <- c('SRP025982', 'SRP42161')
 if(any(!file.exists(file.path(colon_proj, 'rse_gene.Rdata')))) {
 sapply(colon_proj, download_study)
 }

 blood_proj <- c('SRP066834', 'SRP041736', 'SRP060416')
 if(any(!file.exists(file.path(blood_proj, 'rse_gene.Rdata')))) {
 sapply(blood_proj, download_study)
 }
 proj <- c(colon_proj,blood_proj)

 dat <- lapply(proj, function(x) {
 load(file.path(x, 'rse_gene.Rdata'))
 return(rse_gene)
 })
 proj

 sapply(dat, dim)

 metadata <- all_metadata('sra')

 write.table(metadata, "recount_metadata.csv")

 mdat <- do.call(cbind, dat)

 write.table(mdat, "recount_mdat.csv")
rna-seq metadata R-studio • 14k views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 1512 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