Charles Berry | 9 Feb 21:26 2013

DataFrame bug?

>>

Subset replacement like this

   df['a','c2']<-3 

depends on the position of row 'a' when 'c2' is a new column.

Row 'a' first:

> df1 <- DataFrame(c1=1:2,row.names=c("a","b"))
> df1['a','c2'] <- 3
> df1
DataFrame with 2 rows and 2 columns
         c1        c2
  <integer> <numeric>
a         1         3
b         2         3

Row 'a' second:

> df2 <- DataFrame(c1=1:2,row.names= rev( c("a","b") ))
> df2['a','c2'] <- 3
> df2
DataFrame with 2 rows and 2 columns
         c1        c2
  <integer> <numeric>
b         1        NA
a         2         3

FWIW, the latter - but not the former - agrees with "the 'DataFrame' behaves
very similarly to 'data.frame'"(from the help page).

> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-apple-darwin9.8.0/x86_64 (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] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] IRanges_1.16.4     BiocGenerics_0.4.0

loaded via a namespace (and not attached):
[1] parallel_2.15.2 stats4_2.15.2

_______________________________________________
Bioconductor mailing list
Bioconductor@...
https://stat.ethz.ch/mailman/listinfo/bioconductor
Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor


Gmane