On Wed, Feb 25, 2009 at 10:01 PM, Juliet Hannah <juliet.han...@gmail.com> wrote:
> Out of curiosity, what would be a good way to do this without using
> the reshape package? Thanks!

Well the core of the melt code is this:

    ids <- data[, var$id, drop = FALSE]
    df <- do.call("rbind", lapply(var$measure, function(x) {
        data.frame(ids, x, data[, x])
    }))
    names(df) <- c(names(ids), variable_name, "value")

Hadley

-- 
http://had.co.nz/

______________________________________________
R-help@r-project.org 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