[R] Latex problem in Hmisc (3.8-1) and Mac Os X with R 2.11.1

From: moleps islon <moleps2_at_gmail.com>
Date: Fri, 18 Jun 2010 07:32:52 +0200

Dear all,

I did post this more or less identical mail in a follow up to another question I posted, but under another heading. I try again, but now under the correct header.

upon running this code (from the Hmisc library-latex function) I believe the call to summary.formula is allright and produces wonderful tables, but the latex command results in a correct formatted table but where all the numbers and the test columns are wrong. I've pasted in both the R code and the resulting latex code annotated with comments from the run. Does the same code produce correct cell-entries in other installation ?



sex <- factor(sample(c("m","f"), 500, rep=TRUE)) age <- rnorm(500, 50, 5)
treatment <- factor(sample(c("Drug","Placebo"), 500, rep=TRUE)) symp <- c('Headache','Stomach Ache','Hangnail',

         'Muscle Ache','Depressed')

symptom1 <- sample(symp, 500,TRUE)
symptom2 <- sample(symp, 500,TRUE)
symptom3 <- sample(symp, 500,TRUE)
Symptoms <- mChoice(symptom1, symptom2, symptom3, label='Primary Symptoms')
table (Symptoms)
f <- summary(treatment ~ age + sex + Symptoms, method="reverse", test=TRUE) g <- summary(treatment ~ age + sex + symptom1, method="reverse", test=TRUE)


> latex(g,file="")
% latex.default(cstats, title = title, caption = caption, rowlabel =

rowlabel,      col.just = col.just, numeric.dollar = FALSE,
insert.bottom = legend,      rowname = lab, dcolumn = dcolumn,
extracolheads = extracolheads,      extracolsize = Nsize, ...)
 \caption{Descriptive Statistics by treatment\label{g}}


$N=263$}}&\multicolumn{1}{c}{{\scriptsize $N=237$}}&\tabularnewline





\noindent {\scriptsize $a$\ }{$b$\ }{\scriptsize $c$\ } represent the
lower quartile $a$, the median $b$, and the upper quartile $c$\ for continuous variables.\\Numbers after percents are frequencies.\\\indent Tests used:\\\textsuperscript{\normalfont 1}Wilcoxon test; \textsuperscript{\normalfont 2}Pearson test

###Then I did another example from Harrellīs "statistical tables and plots...."



# Variables in prostate had units in ( ) inside variable labels. Move
# these units of measurements to separate units attributes
# wt is an exception. It has ( ) in its label but this does not denote units
# Also make hg have a legal R plotmath expression
prostate<-upData(prostate, moveUnits=TRUE,units=c(wt="", hg="g/100*ml"),labels=c(wt="Weight Index = wt(kg)-ht(cm)+200"))

stage<- factor(stage, 3:4, c("Stage 3","Stage 4")) s6<-summary(stage~rx+age+wt+pf+hx+sbp+dbp+ekg+hg+sz+sg+ap+bm,method="reverse", overall=TRUE, test=TRUE)
w<-latex(s6, size="smaller[3]", outer.size="smaller", Nsize="smaller",long=TRUE, prmsd=TRUE,
msdsize="smaller",middle.bold=TRUE, ctable=TRUE)

##This refused to run ( as long as the ctable=T was included), but without it

latex (s6)

##I do get a nicely formated table, but again the numbers are all wrong... Also

##latex(s6, long=TRUE, prmsd=TRUE, msdsize="smaller",middle.bold=TRUE)

##makes no difference from latex(s6) alone with regards to formatting...

Quite frustrating-Any suggestions??


R-help_at_r-project.org 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. Received on Fri 18 Jun 2010 - 06:08:56 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 Jun 2010 - 13:50:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive