Hi David Winsemius, thanks a lot for the answer that I finally spotted amongst my verbose message.
Many thanks, and I see that it does work now: I had to change the variable names of the subset HHum02 because all the rows from main dataset were still there invisibly (after I used subset to remove them). For this reason the xtabs solution did not appear to work. Having saved the output table, then loaded it again, the xtabs solution works perfectly. another solution (when HHum02 is replaced by Humn02) is: mdata <- melt(Humn02) Denormal <- cast(mdata, CASW~CO2Group~variable, sum) Check out the power of the reshape package here: http://had.co.nz/reshape/ Many thanks again, Robin -- View this message in context: http://r.789695.n4.nabble.com/Denormalize-data-tp3729817p3730137.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.