[Rd] relist.list broken for skeletons with empty elements

From: Michael Lawrence <lawrence.michael_at_gene.com>
Date: Thu, 11 Aug 2011 04:07:00 -0700


Hi guys,

This seems wrong:

> x <- list(2, numeric())
> relist(unlist(x), x)

[[1]]
[1] 2

[[2]]
[1] NA 2

Here is the definition:

function (flesh, skeleton = attr(flesh, "skeleton")) {

    ind <- 1L
    result <- skeleton
    for (i in seq_along(skeleton)) {

        size <- length(unlist(result[[i]]))
        result[[i]] <- relist(flesh[ind:(ind + size - 1L)], result[[i]])
        ind <- ind + size

    }
    result
}

That should probably use seq(..., length=size) or something instead of the ":" function.

Thanks,
Michael

        [[alternative HTML version deleted]]



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 11 Aug 2011 - 11:10:27 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 11 Aug 2011 - 15:15:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive