[BioC] DataFrame bug?

Valerie Obenchain vobencha at fhcrc.org
Mon Feb 11 20:16:17 CET 2013


Hi Charles,

Thanks for reporting the bug. Now fixed in 1.17.32 devel and 1.16.5 in 
release.

Valerie

library(RUnit)
DF <- DataFrame("A"=1:5,row.names=letters[1:5])
df <- data.frame("A"=1:5,row.names=letters[1:5])
 >   checkIdentical(DF['a','B'] <- 1, df['a','B'] <- 1)
[1] TRUE

DF <- DataFrame("A"=1:5,row.names=letters[1:5])
df <- data.frame("A"=1:5,row.names=letters[1:5])
 >   checkIdentical(DF['c','B'] <- 1, df['c','B'] <- 1)
[1] TRUE

 > sessionInfo()
...

other attached packages:
[1] RUnit_0.4.26       IRanges_1.16.5     BiocGenerics_0.4.0

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


On 02/09/2013 12:26 PM, Charles Berry wrote:
>>>
>
> 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 at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>



More information about the Bioconductor mailing list