Suppose I have a table constructed from structable or simply just an 
object of class table. How can I convert it to a latex object? I looked 
in RSiteSearch, but only found info about matrices or data frames.

Steve


For example, here is a table t2

 > str(t2)
  table [1:2, 1:2, 1:2]   6   8 594 592  57 ...
  - attr(*, "dimnames")=List of 3
   ..$ Hospital : chr [1:2] "A" "B"
   ..$ Survival : chr [1:2] "Died" "Survived"
   ..$ Condition: chr [1:2] "Good" "Poor"

Here's what happens with latex(t2):

  latex(t2)
Error in x[, j] : incorrect number of dimensions

Next,  here's what happens with a structtable.

 > tab=structable(Hospital ~ Condition + Survival, data=t2)
 > tab
                    Hospital    A    B
Condition Survival
Good      Died                 6    8
           Survived           594  592
Poor      Died                57    8
           Survived          1443  192

If I use latex(tab) I get

Error in dimnames(cx) <- list(rnam, nam) :
        length of 'dimnames' [1] not equal to array extent
In addition: Warning messages: ...(deleted)...

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to