Marc, it's the second "expansion" type transformation I was after, although your expand.dft looks quite complicated? here's what I finaly came up with - the bold lines correspond to what expand.dft does?
> orig<-matrix(c(40,5,30,25), c(2,2)) > orig [,1] [,2] [1,] 40 30 [2,] 5 25 > flat<-as.data.frame.table(orig) > ind<-rep(1:nrow(flat), times=flat$Freq) > flat<-flat[ind,-3] > sample<-matrix(table(flat[sample(1:length(ind),10),]), c(2,2)) > sample [,1] [,2] [1,] 4 2 [2,] 1 3 So i get from the orig matrix to the sample matrix, expanding and contracting it back in between! It's just that I was hoping there was a more direct way of doing it! Thanks! maja -- View this message in context: http://www.nabble.com/disaggregate-frequency-table-into-flat-file-tp17396040p17405966.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.