[Bioc-devel] DataFrame's do not like ordered factors
Thanks for the quick check, Herv?. R-3.0 is shaping up to be a good one ... I mean, I was excited for the 64-bit integer support, but now ... this is already fixed? yes! :-) Cheers, -steve
On Wed, Mar 6, 2013 at 12:42 PM, Herv? Pag?s <hpages at fhcrc.org> wrote:
Hi Steve, On 03/06/2013 09:10 AM, Steve Lianoglou wrote:
I don't think I've seen this one discussed before .. consider:
========= Reproduce me ===========
library(IRanges)
df1 <- data.frame(a=rnorm(10), b=head(letters, 10))
df2 <- transform(df1, b=factor(b))
df3 <- transform(df1, b=factor(b, sample(b), ordered=TRUE))
DF1 <- DataFrame(df1)
DF2 <- DataFrame(df2)
DF3 <- DataFrame(df3)
## Now let's take a look at them
DF1 ## looks purty
DF2 ## looks nice
DF3 ## woops!
DataFrame with 10 rows and 2 columns
Error in matrix(unlist(lapply(object, function(x) paste("<", class(x), :
length of 'dimnames' [2] not equal to array extent
===================================
This problem seems to be gone in BioC devel:
> DF3
DataFrame with 10 rows and 2 columns
a b
<numeric> <ordered>
1 -0.98455768 a
2 0.35134835 b
3 0.04657733 c
4 1.86833121 d
5 0.54396927 e
6 -0.64201201 f
7 0.45709514 g
8 0.47964197 h
9 -1.37778026 i
10 0.07408252 j
> sessionInfo()
R Under development (unstable) (2013-02-19 r62008) 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.35 BiocGenerics_0.5.6 loaded via a namespace (and not attached): [1] stats4_3.0.0 tools_3.0.0 H.
Here it only looks like it's messing w/ the `show` method, but it will bite you in other places where you expect DataFrame's to function "as normal." I'll take a deeper look at this after I get through a deadline for next week, but if someone has some time between now and then ... Relevant info: R version 2.15.2 Patched (2012-11-12 r61105) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) .... other attached packages: [1] IRanges_1.16.6 BiocGenerics_0.4.0 devtools_1.1 -steve
-- Herv? Pag?s Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpages at fhcrc.org Phone: (206) 667-5791 Fax: (206) 667-1319
Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact