Dear all,

given I have a data.frame in a format like this

mydf <- data.frame(age=rep(1:3,5),
                   year=c(rep(1996,3), rep(1997,3), rep(1998,3),
                     rep(1999,3), rep(2000,3)),
                   income=1:15)
mydf


Now I convert it to some 2D-frequency table like this:
mymatrix <- tapply(X=mydf$income, INDEX=list(mydf$age, mydf$year),
                   FUN=sum)
mymatrix


My question is:
How can I go the opposite way, i.e. from 'mymatrix' to 'mydf'?
Is there an elegant way?

Thanks,
Roland

        [[alternative HTML version deleted]]

______________________________________________
[email protected] 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