"Weiwei Shi" <[EMAIL PROTECTED]> writes:

> I forgot to add my bad solution here:
>
> reverseList <- function(xlist){
>   blist <- xlist[!is.na(xlist)]
>   x0 <- unlist(blist)
>   l0 <- length(blist)
>   d0 <- as.data.frame(matrix(0, l0, 3))
>   d0[,1] <- names(x0)
>   d0[,2] <- x0
>

There is a helper function in Biobase that does this:

reverseSplit

         > reverseSplit
         function (inList) 
         {
             lens = sapply(inList, length)
             nms = rep(names(inList), lens)
             vals = unlist(inList)
             split(nms, vals)
         }
         <environment: namespace:Biobase>

+ seth

-- 
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
http://bioconductor.org

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to