[R] xtable()

Christophe Declercq cdeclercq at nordnet.fr
Fri Sep 27 16:58:08 CEST 2002


> De : owner-r-help at stat.math.ethz.ch
> [mailto:owner-r-help at stat.math.ethz.ch]De la part de Ko-Kang Kevin Wang
> Envoyé : vendredi 27 septembre 2002 12:56
> À : R Help
> Objet : [R] xtable()
>
>
> Hi,
>
> Does anyone know how to manually configure the number of digits printed
> out from xtable()?
>
> For example, I'm exporting a data frame through xtable() into a LaTeX
> table, I only have two columns in the data frame so by default I only get
> two decimal places.  But I'd like at least 5 decimal places.

>From ?xtable:

digits: Numeric vector of length equal to the number of columns of
          the resulting table indicating the number of digits to
          display in the corresponding columns. Since the row names are
          printed in the first column, the length of `align' is one
          greater than `ncol(x)' if `x' is a `data.frame'. Default
          depends of class of `x'.


For example

> library(xtable)
> mydf<-data.frame(id=1:6, x1=rnorm(6), x2=rnorm(6))
> xtable(mydf, digits=c(0, 0, 3, 5))

Christophe

--
Christophe DECLERCQ, MD
Observatoire Régional de la Santé Nord-Pas-de-Calais
13, rue Faidherbe 59046 LILLE Cedex FRANCE
Phone +33 3 20 15 49 24
Fax   +33 3 20 55 92 30
E-mail c.declercq at orsnpdc.org


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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