[R] error in format.df when using dec

Rainer M Krug RKrug at sun.ac.za
Tue Nov 7 15:08:30 CET 2006


When using format.df with dec, the formating does not work (see code 
below).

Any help appreciated how I could do the formating (I want to export to 
LaTeX),

Rainer

I am using the newest version of Hmisc from CRAN, R version:

 > version
                _
platform       i686-pc-linux-gnu
arch           i686
os             linux-gnu
system         i686, linux-gnu
status
major          2
minor          4.0
year           2006
month          10
day            03
svn rev        39566
language       R
version.string R version 2.4.0 (2006-10-03)


 > x <- data.frame(a=c(1.123458000012,2.2254154785444447775566), b=3:4)
 > x$m <- matrix(5:8,nrow=2)
 > dim(x)
[1] 2 3
 > x
          a b m.1 m.2
1 1.123458 3   5   7
2 2.225415 4   6   8
 > format.df(x)
   a          b   m 1 m 2
1 "1.123458" "3" "5" "7"
2 "2.225415" "4" "6" "8"
attr(,"col.just")
[1] "r" "r" "r" "r"
 > format.df(x, dec=2)
   a                   b   m 1 m 2
1 "1.120000000000000" "3" "5" "7"
2 "2.230000000000000" "4" "6" "8"
attr(,"col.just")
[1] "r" "r" "r" "r"
 >



-- 
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)21 808 3304
Cell:		+27 - (0)83 9479 042

email:	RKrug at sun.ac.za
       	Rainer at krugs.de



More information about the R-help mailing list