I have an application that would generate a cross-tabulation in array
format in R. In particular, my application would give me a result
similar to that of :

array(5,c(2,2,2,2,2))

The above could be seen as a cross-tabulation of 5 variables with 2
levels each (could be 0 and 1). In this case, the data were such that
each cell has exactly 5 observations. I

Now, I want the output to look like the output of 'xtabs' utility, so
that I can use this output inside 'loglm(MASS)'. In particular, I want
to add (variable) names to each dimension and indicate the levels that
correspond to each cell. The output from 'xtabs' for a data set of
this kind would look like:
> xtabs(~.,data)

, , x3 = 0, x4 = 0, x5 = 0

   x2
x1  0   1
  0   5   5
  1   5   5

, , x3 = 1, x4 = 0, x5 = 0

   x2
x1  0   1
  0   5   5
  1   5   5

, , x3 = 0, x4 = 1, x5 = 0

   x2
x1  0   1
  0   5   5
  1   5   5

, , x3 = 1, x4 = 1, x5 = 0

   x2
x1  0   1
  0   5   5
  1   5   5

, , x3 = 0, x4 = 0, x5 = 1

   x2
x1  0   1
  0   5   5
  1   5   5

, , x3 = 1, x4 = 0, x5 = 1

   x2
x1  0   1
  0   5   5
  1   5   5

, , x3 = 0, x4 = 1, x5 = 1

   x2
x1  0   1
  0   5   5
  1   5   5

, , x3 = 1, x4 = 1, x5 = 1

   x2
x1  0   1
  0   5   5
  1   5   5

Now, I do not generate my output using the 'xtabs' utility. In fact,
my simulations would generate the cross-table directly and not the
dataset.

Can anyone help? R examples have some reference to the 'dimnames'
attribute, but I am not exactly sure.
Also, is there an R function that could do the exact opposite of
'xtabs', that is, may be generate a data frame given its cross-table?

	[[alternative HTML version deleted]]

