From: <ManuelPerera-Chang_at_fmc-ag.com>

Date: Mon 24 Oct 2005 - 22:38:23 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Oct 24 22:54:14 2005

Date: Mon 24 Oct 2005 - 22:38:23 EST

Dear all,

I am exporting to latex a dataframe via xtable(Sweave). My dataframe includes 4 rows and 4 columns. The first two rows containing real values(e.g. a laboratory parameter's mean value), and the two rows at the bottom containing only integers (number of cases).

using display=c('fg','fg','fg','fg') as an argument to xtable I tried to
reach my goal, of presenting the table with numbers formatted with decimal
paces in the upper rows, but with the numbers in the lower rows as integers
(without superfluous commas and decimal places), as shown in the example
below,

Example I:

A B C D

0,52 2,52 0,35 3,63

3,52 6,25 3,62 6,36

11 12 15 16

14 15 16 18

or another example(II):

A B C D

11,5 12,5 10,4 13,6

3,52 6,25 12,62 16,3

11 12 15 16

14 15 16 18

The command used was ...

trend_table<-xtable(trend.table,caption="Caption",display=c('fg','fg','fg','fg'),size='small') trend_table

The R help on xtable states that "fg" displays 'digits' as number of _significant_ digits. As a result no decimal places are shown in the last two rows, as expected, but no decimal places are shown neither in the first two rows, if the real value in the cell is greater than 10, and only 1 decimal place if the value in the cell is lower than 10. Thus instead of example II, I got in Latex the following data:

A B C D

12 13 10 14

3,5 6,3 13 16

11 12 15 16

14 15 16 18

I would prefer to show 1 additional decimal in both cases.Thus my question is how to modify the setting for _significant_ digits(in xtable or in Sweave??) in order to print values.

thanks for your help,

Manuel

Manuel

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Oct 24 22:54:14 2005

*
This archive was generated by hypermail 2.1.8
: Tue 25 Oct 2005 - 01:12:46 EST
*