[R] Table with different digit number
Gabriela Cendoya
gabrielacendoya.rlist at gmail.com
Tue Sep 28 16:59:47 CEST 2010
Try
round(df,2)
for two decimal digits
Gabriela
2010/9/28, Nicola Sturaro Sommacal (Quantide srl) <mailinglist at sturaro.net>:
> 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 at 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.
>
--
_________________________
Lic. María Gabriela Cendoya
Magíster en Biometría
Profesor Adjunto
Facultad de Ciencias Agrarias
UNMdP - Argentina
More information about the R-help
mailing list