[Bioc-devel] list() as dimnames in assayDataNew

Benilton Carvalho beniltoncarvalho at gmail.com
Mon Jun 11 13:42:39 CEST 2012


Hi,

Biobase::assayDataNew() now assigns list() as dimnames(elt) if the
original dimnames(elt) is NULL.

This is a consequence of

dimnames(elt) <- lapply(dimnames(elt), unname)

because lapply(NULL, unname) is list().

Although this works fine for regular R objects (because list() is
coerced back to NULL), this fails when elt is an ff object.

library(ff)
library(Biobase)
x = matrix(1:4, 2)
y = as.ff(x)
dimnames(x)
dimnames(y)
assayDataNew(exprs=x)
assayDataNew(exprs=y)

The documentation for dimnames()<- value states that value "can be
NULL or a list of the same length as dim(x). If a list, its components
are either NULL or a character vector with positive length of
appropriate dimension of x."

Following the strict definition of value given in the documentation
(therefore, ignoring the coercion described in Details), would you
guys consider replacing

        dimnames(elt) <- lapply(dimnames(elt), unname)

by

        dimnames(elt) <- ifelse(is.null(dimnames(elt)), NULL,
lapply(dimnames(elt), unname))

?

Thank you very much,

benilton



More information about the Bioc-devel mailing list