I think this does what you are asking for. It should be
relatively easy to write a method
latex.ftable()
based on this. One or two row.vars and one or two col.vars
should be straightforward (with n.rgroup and n.cgroup used
for the second row and column).
Rich
#### start here
df = data.frame(drug=sample(c("P","V"),100,TRUE),
Hist1=sample(c("Pos","Neg"),100,TRUE),
Hist2=sample(c("Pos","Neg"),100,TRUE))
ft.df <- ftable(drug~Hist1+Hist2,data=df)
str(ft.df)
tmp <- unclass(ft.df)[,]
dimnames(tmp) <- list(rep(attr(ft.df, "row.vars")[[2]], 2),
attr(ft.df, "col.vars")[[1]])
ft.latex <- latex(tmp,
rgroup=attr(ft.df, "row.vars")[[1]],
n.rgroup=c(2,2),
cgroup=names(attr(ft.df, "col.vars"))[1])
______________________________________________
[email protected] 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.