[Bioc-devel] S4Vectors::DataFrame, S4Vectors::cbind() and non-elementwise metadata

Robert Castelo robert.castelo at upf.edu
Wed Oct 25 16:39:41 CEST 2017


hi,

i've the following question on how 'S4Vectors::cbind()' works on 
'DataFrame' objects.

let's say i have the following two toy 'DataFrame' objects, each of them 
including some elementwise and non-elementwise metadata (i hope i'm 
using the right terminology!):

library(S4Vectors)

dtf1 <- DataFrame(col1=1:10)
mcols(dtf1) <- DataFrame(ElementwiseMeta="This is column1")
metadata(dtf1) <- list(Meta1="Object storing column1")

dtf2 <- DataFrame(col2=1:10)
mcols(dtf2) <- DataFrame(ElementwiseMeta="This is column2")
metadata(dtf2) <- list(Meta2="Object storing column2")

now use 'cbind()' to combine the two 'DataFrame' objects:

dtf <- cbind(dtf1, dtf2)

the elementwise metadata is also combined:

mcols(dtf)
DataFrame with 2 rows and 1 column
   ElementwiseMeta
       <character>
1 This is column1
2 This is column2

but the non-elementwise metadata is not:

metadata(dtf)
list()

is there a particular reason why the non-elementwise metadata is not 
also combined?

please find my session information below.

thanks!!!

robert.
ps: sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS: /opt/R/R-3.4.0_BioCdevel/lib64/R/lib/libRblas.so
LAPACK: /opt/R/R-3.4.0_BioCdevel/lib64/R/lib/libRlapack.so

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  stats4    stats     graphics  grDevices utils     datasets
[8] methods   base

other attached packages:
[1] S4Vectors_0.15.14   BiocGenerics_0.23.4 colorout_1.1-2

loaded via a namespace (and not attached):
[1] compiler_3.4.0



More information about the Bioc-devel mailing list