[Bioc-devel] sparse vectors as DataFrame columns

Michael Love love at molgen.mpg.de
Tue Jan 22 11:02:37 CET 2013


hi all,

I am having trouble putting sparse vectors as columns of a DataFrame.  
They have 'length' and '[' methods:

 > library(Matrix)
 > library(IRanges)
 > y <- as(c(1,0,1,0,1,0),"sparseVector")
 > y
sparse vector (nnz/length = 3/6) of class "dsparseVector"
[1] 1 . 1 . 1 .
 > y[6]
sparse vector (nnz/length = 0/1) of class "dsparseVector"
[1] .
 > length(y)
[1] 6
 > DataFrame(spvec = y)
Error in DataFrame(spvec = y) :
   cannot coerce class "dsparseVector" to a DataFrame

 > sessionInfo()
R Under development (unstable) (2012-10-31 r61057)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=C                 LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] IRanges_1.17.26     BiocGenerics_0.5.6 Matrix_1.0-10
[4] lattice_0.20-13     Defaults_1.1-1 BiocInstaller_1.9.6

loaded via a namespace (and not attached):
[1] grid_2.16.0   stats4_2.16.0 tools_2.16.0


thanks!

Mike



More information about the Bioc-devel mailing list