Thank you very much for your solution but it works only in a dataframe object. If I am using an ftable object, it doesn't run.
I use, as a workaround, to fill with blank spaces the left of each number, so when I print the table, it appears aligned to right. But, obviously, this doesn't work for the HTML table, because HTML ignores multiple white spaces . Any suggestion? Thanks in advance, Nicola 2010/9/28 Henrique Dallazuanna <www...@gmail.com> > Try this: > > df[1,] <- as.character(df[1,]) > > On Tue, Sep 28, 2010 at 8:48 AM, Nicola Sturaro Sommacal (Quantide srl) < > mailingl...@sturaro.net> wrote: > >> Hi! >> >> I have a table representing both absolute and relative frequency, for >> example (code to get example data under the signature): >> >> Italy Germany >> absolute 100 105 >> relative 40.51 41.18 >> >> How can I print a different number of decimal digits? I try to transform >> to >> as.character, but cells result aligned to left and I don't like this >> solution. At the end of my work I need to export the table to HTML, so >> this >> can be do also with xtable package. >> >> Thanks in advance for your help. >> >> Nicola Sturaro Sommacal >> >> -- >> Quantide srl >> http://www.quantide.com >> >> ________________________________________________________ >> >> This is the code to get the data.frame with the data above: >> >> df = data.frame(italy = c(100,40.51), germany = c(105, 41.18)) >> row.names(df) = c("absolute", "relative") >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > > > -- > Henrique Dallazuanna > Curitiba-Paraná-Brasil > 25° 25' 40" S 49° 16' 22" O > [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.