hi Michael, thanks for your quick response, comments below..

On 12/2/13 6:29 PM, Michael Lawrence wrote:
> A DataFrame being a SimpleList, coercion to list is immediate, so just 
> coerce to a list instead of a data.frame.
>
> do.call(pmax, as.list(DataFrame(x=1:10,y=2:11)))
>
thanks for tip, so i understand this route does not duplicate the object 
in memory, right?

> I added a do.call method in IRanges that does this for you.
>
that's great, i think however the new do.call() method still needs to be 
exported:

library(IRanges)

do.call(pmax, DataFrame(x=1:10, y=2:11))
Error in do.call(pmax, DataFrame(x = 1:10, y = 2:11)) :
   second argument must be a list
IRanges::do.call(pmax, DataFrame(x=1:10, y=2:11))
Error: 'do.call' is not an exported object from 'namespace:IRanges'

sessionInfo()
R Under development (unstable) (2013-10-23 r64103)
Platform: x86_64-apple-darwin12.5.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets methods
[8] base

other attached packages:
[1] IRanges_1.21.13    BiocGenerics_0.9.1

loaded via a namespace (and not attached):
[1] stats4_3.1.0


robert.

>
>
> On Mon, Dec 2, 2013 at 8:58 AM, Robert Castelo <robert.cast...@upf.edu 
> <mailto:robert.cast...@upf.edu>> wrote:
>
>     hi,
>
>     i would like to do the following:
>
>     library(IRanges)
>
>     do.call(pmax, data.frame(x=1:10, y=2:11))
>      [1]  2  3  4  5  6  7  8  9 10 11
>
>     with 'DataFrame' objects:
>
>     do.call(pmax, DataFrame(x=1:10, y=2:11))
>     Error in do.call(pmax, DataFrame(x = 1:10, y = 2:11)) :
>       second argument must be a list
>
>     concretely with the metadata columns of GRanges objects, which are
>     DataFrame objects.
>
>     currently i can do it by coercing back to DataFrame:
>
>     do.call(pmax, as.data.frame(DataFrame(x=1:10, y=2:11)))
>      [1]  2  3  4  5  6  7  8  9 10 11
>
>     but if the GRanges object is large this becomes a significant
>     overhead in cpu and memory which i guess could be avoided by a
>     pmax method working on DataFrame objects directly.
>
>
>     thanks!!
>     robert.
>     ps: sessionInfo()
>     R Under development (unstable) (2013-10-20 r64082)
>     Platform: x86_64-unknown-linux-gnu (64-bit)
>
>     locale:
>      [1] LC_CTYPE=en_US.UTF8       LC_NUMERIC=C
>      [3] LC_TIME=en_US.UTF8        LC_COLLATE=en_US.UTF8
>      [5] LC_MONETARY=en_US.UTF8    LC_MESSAGES=en_US.UTF8
>      [7] LC_PAPER=en_US.UTF8       LC_NAME=C
>      [9] LC_ADDRESS=C              LC_TELEPHONE=C
>     [11] LC_MEASUREMENT=en_US.UTF8 LC_IDENTIFICATION=C
>
>     attached base packages:
>     [1] parallel  stats     graphics  grDevices utils datasets  methods
>     [8] base
>
>     other attached packages:
>     [1] IRanges_1.21.10    BiocGenerics_0.9.0 vimcom_0.9-91 setwidth_1.0-3
>     [5] colorout_1.0-1
>
>     loaded via a namespace (and not attached):
>     [1] stats4_3.1.0 tools_3.1.0
>
>     _______________________________________________
>     Bioc-devel@r-project.org <mailto:Bioc-devel@r-project.org> mailing
>     list
>     https://stat.ethz.ch/mailman/listinfo/bioc-devel
>
>


        [[alternative HTML version deleted]]

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to