[Rd] Error on executing functions from installed package
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Jun 26 14:49:07 CEST 2013
On 26/06/2013 10:56, Kamal wrote:
> Hi,
>
> I am currently building an R package and I am facing a peculiar problem
> where some of the functions does not work within the package. However, if I
> source the script the function works.
Nothing here is reproducible, so we need to guess. In particular, you
give so details of clRes but sapply is called on 'result', an object not
otherwise mentioned.
My guess is that you are using different functions rbind() in the two
cases, and that your package forgot to import an S4 generic for rbind.
Remember that in a package's namespace 'base' is implicitly imported, so
it takes priority over everything not in the namespace or explicitly
imported.
But it is equally possible you used different objects.
> For example, in a method for parallelization of analysis on each chromosome
> simultaneously I am receiving error at the following position of the code:
>
> # this profile the information chromosome wise and results in "clRes"
>> clRes = clusterApplyLB(cl, Chrs, profilingChr, GenoRanges = GenoRanges,
> Sample = Sample)
>
>> class(clRes)
> [1] "list"
>
>> clRes
> [[1]]
> S4 Object of class GElist; 14 features
>
> start : 14350 69251 84185 116264 153924
> end : 18349 73250 88184 120263 157923
> chr : chr20 chr20 chr20 chr20 chr20
> strand : * * * * *
> binscore : NA
>
>> chrcomb <- sapply(result, function(x) rbind(x))
> Error in rbind(x) : no method for coercing this S4 class to a vector
>
> The above code is part of a function. If I run this code interactively or
> by sourcing the script it runs fine. However, when I execute the function
> from the installed package it gives me the above error. I could not find
> any solution to this. Any insight into the above problem would be highly
> appreciated.
>
>> sessionInfo()
> R version 3.0.0 (2013-04-03)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> locale:
> [1] C
>
> attached base packages:
> [1] parallel stats graphics grDevices utils datasets methods
> [8] base
>
> other attached packages:
> [1] BSgenome.Hsapiens.UCSC.hg18_1.3.19 BSgenome_1.28.0
> [3] methylPipe_0.99.0 Rsamtools_1.12.3
> [5] Biostrings_2.28.0 GenomicRanges_1.12.4
> [7] IRanges_1.18.1 GOstats_2.26.0
> [9] RSQLite_0.11.4 DBI_0.2-7
> [11] graph_1.38.2 Category_2.26.0
> [13] AnnotationDbi_1.22.6 Biobase_2.20.0
> [15] BiocGenerics_0.6.0 snow_0.3-12
>
> loaded via a namespace (and not attached):
> [1] AnnotationForge_1.2.1 GO.db_2.9.0 GSEABase_1.22.0
> [4] RBGL_1.36.2 RCurl_1.95-4.1 XML_3.96-1.1
> [7] annotate_1.38.0 bitops_1.0-5 gdata_2.12.0.2
> [10] genefilter_1.42.0 gplots_2.11.0.1 gtools_2.7.1
> [13] limma_3.16.5 marray_1.38.0 rtracklayer_1.20.2
> [16] splines_3.0.0 stats4_3.0.0 survival_2.37-4
> [19] tools_3.0.0 xtable_1.7-1 zlibbioc_1.6.0
>
> Thanks,
> Kamal
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list