Re: [R] disaggregate frequency table into flat file

2008-05-22 Thread jim holtman
Not exactly clear what you are asking for. Your data.frame.table does not seem related to the original 'orig'. What exactly are you expecting as output? On Wed, May 21, 2008 at 10:16 PM, maiya [EMAIL PROTECTED] wrote: i appologise for the trivialness of this post - but i've been searching

Re: [R] disaggregate frequency table into flat file

2008-05-22 Thread maiya
sorry, my mistake! the data frame should read: orig-as.data.frame.table(orig) orig Var1 Var2 Freq 1AA 40 2BA5 3AB 30 4BB 25 but basicaly i would simply like a sample of the original matrix ( which is a frequency table/contingency table/crosstabulation)

Re: [R] disaggregate frequency table into flat file

2008-05-22 Thread Charilaos Skiadas
On May 22, 2008, at 8:56 AM, maiya wrote: sorry, my mistake! the data frame should read: orig-as.data.frame.table(orig) orig Var1 Var2 Freq 1AA 40 2BA5 3AB 30 4BB 25 but basicaly i would simply like a sample of the original matrix ( which is a

Re: [R] disaggregate frequency table into flat file

2008-05-22 Thread Marc Schwartz
Is this what you want? xtabs(Freq ~ Var1 + Var2, data = orig) Var2 Var1 A B A 40 30 B 5 25 See ?xtabs Or is this what you want? expand.dft - function(x, na.strings = NA, as.is = FALSE, dec = .) { DF - sapply(1:nrow(x), function(i) x[rep(i, each = x$Freq[i]), ],