Helgi Tomasson <helgito at hi.is> writes:> Hi R-people > > I am trying to have R write latex-code. > > "\begin{tabular}" > > and > > "\end{tabular} > > do not produce similar results. I would like to something like > > write("\begin{tabular} ,file=. . .) > . > . > . > write("\end{tabular},file=. . .)Hmmm. Not too clear what your problem is but if something is eating your backslashes, chances are that you just need to double them, as in> cat("\\help\n")\help>In some rare cases you need to redouble them, but this is not one of them, I think.... -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /''_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi R-people I am trying to have R write latex-code. "\begin{tabular}" and "\end{tabular} do not produce similar results. I would like to something like write("\begin{tabular} ,file=. . .) . . . write("\end{tabular},file=. . .) regards Helgi Tomasson -- Helgi Tomasson FAX: 354-552-6806 University of Iceland PHONE:354-525-4571 Faculty of Economics and Business Administration email:helgito at rhi.hi.is Oddi v/ Sturlugotu IS-101 Reykjavik ICELAND -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Mon, 22 May 2000, Helgi Tomasson wrote:> Hi R-people > > I am trying to have R write latex-code. > > "\begin{tabular}" > > and > > "\end{tabular} > > do not produce similar results. I would like to something like > > write("\begin{tabular} ,file=. . .) > . > . > . > write("\end{tabular},file=. . .) > > regards > > Helgi Tomasson >Try write("\\begin...",....) and "\\end", as "\" is a special character. Regards, Uwe Ligges -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On 22 May 2000, Peter Dalgaard BSA wrote:> Helgi Tomasson <helgito at hi.is> writes: > > > Hi R-people > > > > I am trying to have R write latex-code. > > > > "\begin{tabular}" > > > > and > > > > "\end{tabular} > > > > do not produce similar results. I would like to something like > > > > write("\begin{tabular} ,file=. . .) > > . > > . > > . > > write("\end{tabular},file=. . .) > > Hmmm. Not too clear what your problem is but if something is eating > your backslashes, chances are that you just need to double them, as in > > > cat("\\help\n") > \help > > > > In some rare cases you need to redouble them, but this is not one of > them, I think....Oh. It is one of these cases , I think: \b means: Backspace! To write something with "\" in it, it is much safer to double the "\" every time. Regards, Uwe Ligges> -- > O__ ---- Peter Dalgaard Blegdamsvej 3 > c/ /''_ --- Dept. of Biostatistics 2200 Cph. N > (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 > ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Mon, 22 May 2000, Uwe Ligges wrote:> On 22 May 2000, Peter Dalgaard BSA wrote: > > > Helgi Tomasson <helgito at hi.is> writes: > > > > > Hi R-people > > > > > > I am trying to have R write latex-code.> > > do not produce similar results. I would like to something like > > > > > > write("\begin{tabular} ,file=. . .) > > > . > > > . > > > . > > > write("\end{tabular},file=. . .) > > > > Hmmm. Not too clear what your problem is but if something is eating > > your backslashes, chances are that you just need to double them, as in > > > > > cat("\\help\n") > > \help > > > > In some rare cases you need to redouble them, but this is not one of > > them, I think.... > > Oh. It is one of these cases , I think: > \b means: Backspace! > > To write something with "\" in it, it is much safer to double the "\" > every time.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) ---- Robert King, Australian Environmental Studies, Griffith University, Australia 3875 6677 Robert.King at mailbox.gu.edu.au http://www.ens.gu.edu.au/robertk/ "I would rather spend 10 hours reading someone else''s source code than 10 minutes listening to Musak waiting for technical support which isn''t." (By Dr. Greg Wettstein, Roger Maris Cancer Center) -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._