[Bioc-devel] DataFrame's do not like ordered factors

Steve Lianoglou mailinglist.honeypot at gmail.com
Wed Mar 6 18:10:15 CET 2013


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
===================================

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

-- 
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



More information about the Bioc-devel mailing list