[Bioc-devel] feature request: pmax for columns of DataFrame objects

Robert Castelo robert.castelo at upf.edu
Mon Dec 2 17:58:41 CET 2013


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



More information about the Bioc-devel mailing list