Hi I am using the latex() command from the Hmisc package to export table to latex. For formating of the values, I use the format() function. But I don't manage to get the format of the values right: I don't want scientific notation, but if I say scientific=FALSE, I get many digits after the decimal point which I can not control with digits=... and nsmall=... in the format command. Is there another way of formating the values to three decimal digits? Or another way of exporting them to LaTeX? Thanks Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel: +27 - (0)72 808 2975 (w) Fax: +27 - (0)86 516 2782 Fax: +27 - (0)21 808 3304 (w) Cell: +27 - (0)83 9479 042 email: RKrug at sun.ac.za Rainer at krugs.de
Rainer M Krug <RKrug <at> sun.ac.za> writes:> I am using the latex() command from the Hmisc package to export table > to latex. For formating of the values, I use the format() function. But > I don't manage to get the format of the values right: I don't want > scientific notation, but if I say scientific=FALSE, I get many digits > after the decimal point which I can not control with digits=... and > nsmall=... in the format command. > > Is there another way of formating the values to three decimal digits? > > Or another way of exporting them to LaTeX?There were a few bugs in the current versions of format.df (called by latex), and the "scientific" problem could have been among them. Try to download latex.s from http://biostat.mc.vanderbilt.edu/svn/R/Hmisc/branches/release_3.2-1/R/latex.s do library(Hmisc) source("latex.s") and check if the problem disappears. If it does, write a mail to [charles.dupont at vanderbilt.edu] and ask him to make the version public as soon as possible. Dieter
Hi,> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Rainer M Krug > Sent: Wednesday, December 13, 2006 8:47 AM > To: r-help at stat.math.ethz.ch > Subject: [R] exporting a table to latex> Is there another way of formating the values to three decimal digits? > > Or another way of exporting them to LaTeX? >I hope I did not oversee any emails concerning your question. Typically, I use the xtable-package. Please let me know if the following code is not doing what you hope for. Best, Roland mydata <- data.frame(Category=LETTERS[1:10], Percentage=runif(10)) library(xtable) xtable(mydata, digits=c(0,0,3)) ### LaTeX format => default #### you can even create an HTML table print(xtable(mydata, digits=c(0,0,5)), type="HTML") ---------- This mail has been sent through the MPI for Demographic Rese...{{dropped}}