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. I had a look at ?xtable() but can't seem to find an example. Cheers, Kevin ------------------------------------------------------------------------------ Ko-Kang Kevin Wang Postgraduate PGDipSci Student Department of Statistics University of Auckland New Zealand Homepage: http://www.stat.auckland.ac.nz/~kwan022 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Try the following: library(xtable) dat <- data.frame(a = c(1,2,3,4,5,6), b = c(2,4,6,8,10,12)) xtable(dat, digits = c(0,5,5)) You want to have a columns+1 vector of didgets since xtable will have three columns. At 11:55 PM 9/27/2002 +1200, Ko-Kang Kevin Wang wrote:>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. > >I had a look at ?xtable() but can't seem to find an example. > > >Cheers, > >Kevin > >------------------------------------------------------------------------------>Ko-Kang Kevin Wang >Postgraduate PGDipSci Student >Department of Statistics >University of Auckland >New Zealand >Homepage: http://www.stat.auckland.ac.nz/~kwan022 > > >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.->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 >_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._>With best wishes and kind regards I am Sincerely, Corey A. Moffet Support Scientist University of Idaho Northwest Watershed Research Center 800 Park Blvd, Plaza IV, Suite 105 Boise, ID 83712-7716 (208) 422-0718 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
How about, print(xtable(x, digits = c(1, 5, 5))), where x is n x 2? -roger _______________________________ UCLA Department of Statistics rpeng at stat.ucla.edu http://www.stat.ucla.edu/~rpeng On Fri, 27 Sep 2002, Ko-Kang Kevin Wang wrote:> 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. > > I had a look at ?xtable() but can't seem to find an example. > > > Cheers, > > Kevin > > ------------------------------------------------------------------------------ > Ko-Kang Kevin Wang > Postgraduate PGDipSci Student > Department of Statistics > University of Auckland > New Zealand > Homepage: http://www.stat.auckland.ac.nz/~kwan022 > > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._