Skip to content

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

3 messages · Benilton Carvalho, Martin Morgan

#
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
#
On 06/11/2012 04:42 AM, Benilton Carvalho wrote:
Hi Benilton -- I did

   if (!is.null(dimnames(elt)))
       dimnames(elt) <- lapply(dimnames(elt), unname)

in 2.17.6. Thanks for the report.

Martin

  
    
#
Thank you very much, Martin.

b
On 11 June 2012 22:03, Martin Morgan <mtmorgan at fhcrc.org> wrote: