[R] backslash
Thomas Lumley
thomas at biostat.washington.edu
Tue May 23 17:06:18 CEST 2000
On Tue, 23 May 2000 Robert.King at mailbox.gu.edu.au wrote:
> This means that for the \\ at the end of lines of tables you need to
> double each backslash. e.g. for some tables I produced I had R code like
> this ...
>
> tabfile _ "../tex/zzq.table"
> write("\\begin{table}\\label{table:zzq}\\caption[Summary of results --- simulation zzq]",file=tabfile,append=T)
> write("\\begin{tabular}{|l|c|c|c|c|}",file=tabfile,append=T)
> write("\\multicolumn{5}{c}{$\\hat\\la$ (true value = \\laval)}\\\\",file=tabfile ,append=T)
> write("\\hline",file=tabfile,append=T)
> write("method & mean & median & std. dev. & IQR \\\\",file=tabfile,append=T)
> write("\\hline",file=tabfile,append=T)
> write(paste('starship (K-S) &',signif(mean(ks.zzq$l1),4),' & ',
> signif(median(ks.zzq$l1),4),' & ', signif(sqrt(var(ks.zzq$l1)),4),' & ',
> signif((quantile(ks.zzq$l1,.75)[[1]]-quantile(ks.zzq$l1,.25)[[1]]),4),
> ' \\\\ '),file=tabfile,append=T)
> write("\\hline",file=tabfile,append=T)
You can use write.table to produce the data portion of the table, which is
a bit simpler
eg
write.table(round(x,2),quote=FALSE,sep="$ & $",eol="$\\\\
\n $",col.names=FALSE,row.names=FALSE)
where the $ signs ensure that negative numbers are printed with a minus
sign rather than a hyphen.
-thomas
Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list