[R] ftable to latex

Felipe Carrillo mazatlanmexico at yahoo.com
Wed Jan 14 03:07:13 CET 2009


Dear List: 
After reading some of the e-mails related to this topic I found one that converts a ftable to latex nicely.

library(Hmisc)
 n=500
 sex <- factor(sample(c("m","f"), n, rep=TRUE))
 treatment <- factor(sample(c("Drug","Placebo"), n, rep=TRUE))
 symptom <- factor(sample( c('H','S','G'), n,TRUE))
 # I want this output in latex
ftable(symptom~treatment+sex)
 ss = summary(symptom~treatment+sex,fun=table)
 latex(ss)

But the next example gets rid off the rownames and column names after creating the latex table.
x <- ftable(Titanic, row.vars = 1:2, col.vars = "Survived")
latex(x)





Felipe D. Carrillo  
Supervisory Fishery Biologist  
Department of the Interior  
US Fish & Wildlife Service  
California, USA




More information about the R-help mailing list