Question: no method for coercing S4 class to a vector
3.8 years ago by
Guest User • 12k
Guest User • 12k wrote:
Dear all, I have a similar problem to this poster here: http://grokbase.com/t/r/bioc-devel/141cegqvpf/no-method-for-coercing- this-s4-class-to-a-vector The error message is: Error in as.vector(x) : no method for coercing this S4 class to a vector In my case, however, I'm using the as.data.frame function on a GRanges object. When I source my function it works fine, but when I make it into a package and then run the function I get the S4 class error. The function seems to be from BiocGenerics: > as.data.frame standardGeneric for "as.data.frame" defined from package "BiocGenerics" function (x, row.names = NULL, optional = FALSE, ...) standardGeneric("as.data.frame") <environment: 0x3801ad8=""> Methods may be defined for arguments: x Use showMethods("as.data.frame") for currently available ones. So, I have included this importFrom("BiocGenerics", as.data.frame) in NAMESPACE and this Depends: BiocGenerics in DESCRIPTION. It still does not work. I must be missing something. Any help is highly appreciated! Thanks Ninni -- output of sessionInfo(): > sessionInfo() R version 3.1.1 (2014-07-10) Platform: x86_64-pc-linux-gnu (64-bit) locale:  LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C  LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8  LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8  LC_PAPER=en_US.UTF-8 LC_NAME=C  LC_ADDRESS=C LC_TELEPHONE=C  LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages:  parallel stats graphics grDevices utils datasets methods  base other attached packages:  rtracklayer_1.24.0 GenomicRanges_1.16.2 GenomeInfoDb_1.0.2  IRanges_1.22.10 BiocGenerics_0.10.0 loaded via a namespace (and not attached):  BatchJobs_1.2 BBmisc_1.6 BiocParallel_0.6.0  Biostrings_2.32.0 bitops_1.0-6 brew_1.0-6  BSgenome_1.32.0 codetools_0.2-9 DBI_0.2-7  digest_0.6.4 fail_1.2 foreach_1.4.2  GenomicAlignments_1.0.0 iterators_1.0.7 plyr_1.8.1  Rcpp_0.11.1 RCurl_1.95-4.1 Rsamtools_1.16.0  RSQLite_0.11.4 sendmailR_1.1-2 stats4_3.1.1  stringr_0.6.2 tools_3.1.1 XML_3.98-1.1  XVector_0.4.0 zlibbioc_1.10.0 -- Sent via the guest posting facility at bioconductor.org.
ADD COMMENT • link •