Skip to content
Prev 10268 / 63424 Next

xtabs to dataframe fails (PR#3754)

daniel.frey@switzerland.org wrote:
a) data.frame() calls as.data.frame()
b) as.data.frame() uses its method as.data.frame.table(), because
  class(a.x)
  [1] "xtabs" "table"
c) ?as.data.frame.table tells us:
     `as.data.frame.table' is a method for the generic function
     `as.data.frame' to convert the array-based representation of a
     contingency table to a data frame containing the classifying
     factors and the corresponding counts (the latter as component
     `Freq'). This is the inverse of `xtabs'.

So, what is the bug?

I guess you expect something like 
  data.frame(unclass(a.x))

Uwe Ligges