I have a vague recollection of seeing a R-function that will output a table or matix in a format suitable for the tabular enviroment in LaTeX. But I cannot find it. Any hints? Bendix ---------------------- Bendix Carstensen Senior Statistician Steno Diabetes Centre Niels Steensens Vej 2 DK-2820 Gentofte Denmark tel: +45 44 43 87 38 mob: +45 28 25 87 38 fax: +45 44 43 73 13 bxc at novo.dk www.biostat.ku.dk/~bxc ---------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
At 13:19 07/09/00 +0200, Diego Kuonen wrote:>"BXC (Bendix Carstensen)" wrote: >> I have a vague recollection of seeing a R-function >> that will output a table or matix in a format suitable >> for the tabular enviroment in LaTeX. > >The Heiberger-Harrell display library is used to interface >S-Plus with LaTeX.; seeThe collection contains a few useful functions for manipulating character data and for making LaTeX tables, but it's hardly what one would call an "interface" with LaTeX.> http://hesweb1.med.virginia.edu/biostat/s/Design.html > >But, it's worth to have a look at > http://hesweb1.med.virginia.edu/biostat/s/help/Design.Overview.html > >under "COPYRIGHT NOTICE": > > ### GENERAL DISCLAIMER This program is free software; > ### you can redistribute it and/or modify it under the > ### terms of the GNU General Public License [...] > ### with the exception that you may not port any code > ### in the Design library to R. [...] > ### In short: you may > ### use this code any way you like other than porting > ### any of the code to R, as long as you don't charge > ### money for it, remove this notice, or hold anyone > ### liable for its results. [...] > >Isn't this contradictory?It's a condition any author may choose to impose on his or her otherwise public code. You may not like it but you should respect it.> >:-( > > Diego > >-- >Diego Kuonen http://wap.kuonen.com http://stat.kuonen.com >http://www.Statoo.ch Kya aap statooed hai? http://www.Statoo.com >http://www.LinuxPlanet.ch Linux - Ultimate Anti-Virus Software >WAP on http://WAP.lugo.ch SURF on http://www.LUGO.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 >_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._> >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
"BXC (Bendix Carstensen)" wrote:> I have a vague recollection of seeing a R-function > that will output a table or matix in a format suitable > for the tabular enviroment in LaTeX.The Heiberger-Harrell display library is used to interface S-Plus with LaTeX.; see http://hesweb1.med.virginia.edu/biostat/s/Design.html But, it's worth to have a look at http://hesweb1.med.virginia.edu/biostat/s/help/Design.Overview.html under "COPYRIGHT NOTICE": ### GENERAL DISCLAIMER This program is free software; ### you can redistribute it and/or modify it under the ### terms of the GNU General Public License [...] ### with the exception that you may not port any code ### in the Design library to R. [...] ### In short: you may ### use this code any way you like other than porting ### any of the code to R, as long as you don't charge ### money for it, remove this notice, or hold anyone ### liable for its results. [...] Isn't this contradictory? :-( Diego -- Diego Kuonen http://wap.kuonen.com http://stat.kuonen.com http://www.Statoo.ch Kya aap statooed hai? http://www.Statoo.com http://www.LinuxPlanet.ch Linux - Ultimate Anti-Virus Software WAP on http://WAP.lugo.ch SURF on http://www.LUGO.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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>>>>> " " == BXC (Bendix Carstensen) <BXC at novo.dk> writes:> I have a vague recollection of seeing a R-function that will output > a table or matix in a format suitable for the tabular enviroment in > LaTeX. > But I cannot find it. Any hints? This is my 2 cent's worth - we hacked it here in the dept. some time ago. -- Dr. Joerg Kindermann Knowledge Discovery Team GMD - German National Research Center for Information Technology - phone: +49 02241 142437 fax: +49 02241 142342 http://ais.gmd.de/KD/ ---------------------------------------------------------------------- mat2TeX <- function(mat, digits=4, rowNameTitle="", file="", roundNum=NULL, rowNameAlign="l",matAlign="r", prtHead=T, prtEnd=T, extraTitle=NULL, rowNameCols=1, append=F) { nr <- nrow(mat); nc <- ncol(mat) rn <- rownames(mat); cn <- colnames(mat) cmat_array("",dim=dim(mat)) if (!is.null(roundNum)) { if (length(roundNum)==nc){ for(i in 1:nc) mat[,i]_round(mat[,i],roundNum[i]) } else { errif(length(roundNum!=1)) mat_round(mat,roundNum) } } for(i in 1:nc){ cmat[,i]_format(mat[,i], digits=digits) } if(is.null(cn)) cn <- 1:nc if(is.null(rn)) rn <- 1:nr if(rowNameTitle == "") rowNameTitle <- paste(rep(" ",rowNameCols), collapse="|") cat("\n ", file=file, append=append) # write new if necessary if (length(rowNameAlign)==1) rowNameAlign_rep(rowNameAlign,rowNameCols) if (length(matAlign)==1) matAlign_rep(matAlign,nc) if (prtHead){ cat("\\begin{tabular}[c]{", paste(c("",rowNameAlign, matAlign,""), collapse="|"), "}\\hline\n", sep="", file=file, append=T) if (!is.null(extraTitle)) cat(extraTitle,"\\\\ \n",file=file, append=T) cat( paste(c(rowNameTitle,cn), collapse=" & "),"\\\\ \\hline\n", file=file, append=T) } for(j in 1:nr){ cat(paste(c(rn[j], cmat[j,]), collapse=" & "), "\\\\\n", file=file, append=T) } cat("\\hline\n", file=file, append=T) if (prtEnd) cat("\\end{tabular}\n", file=file, append=T) } ------------------------------------------------------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Diego Kuonen wrote:> Does anybody know if Knut Suebert's library "tex" is available for > download and testing?Here you are: <<R2latex.zip>> --- D.Trenkler --- ************************************************************************ ********* Dr. Dietrich Trenkler (dtrenkler at oec.uni-osnabrueck.de) Statistik / Empirische Wirtschaftsforschung Universitaet Osnabrueck Rolandstrasse 8 Phone: +49(0) 541-969-2753 D-49069 Osnabrueck Fax : +49(0) 541-969-2744 GERMANY ************************************************************************ ********* -------------- next part -------------- A non-text attachment was scrubbed... Name: R2latex.zip Type: application/octet-stream Size: 9011 bytes Desc: not available Url : https://stat.ethz.ch/pipermail/r-help/attachments/20000907/ffd2b44a/R2latex.obj
On Thu, 7 Sep 2000, BXC (Bendix Carstensen) wrote:> I have a vague recollection of seeing a R-function > that will output a table or matix in a format suitable > for the tabular enviroment in LaTeX. > > But I cannot find it. Any hints?You can do most of this with write.table I use write.table(x,quote=FALSE,sep=" & ",eol="\\\\ \n",row.names=FALSE) or if I have negative numbers and want a proper minus sign, sep= "$ & $", eol="$ \\\\ \n$" Often I preprocess x with zapsmall() and format() to get rid of scientific notation. It would be nice to have an extension to do all this properly, and to write eg 3.5\times 10^{-5} rather than 3.5e-5. Some of the code I have seen for latex tables in S produces very ugly tables with lines everywhere (rather like some of the examples in the LaTeX book, but that at least has the excuse of needing to show off the capabilities of the program). -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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi there, here's another attempt to write a nice function that converts a matrix into Latex-code. Maybe you want to try it (it's an english version). Martina "BXC (Bendix Carstensen)" wrote:> > I have a vague recollection of seeing a R-function > that will output a table or matix in a format suitable > for the tabular enviroment in LaTeX. > > But I cannot find it. Any hints?-------------- next part -------------- A non-text attachment was scrubbed... Name: latex_table.R Type: application/x-unknown-content-type-r_auto_file Size: 3763 bytes Desc: not available Url : https://stat.ethz.ch/pipermail/r-help/attachments/20000908/7c37eff6/latex_table.bin