On Thu, 29 Oct 2009 12:29:42 -0400 Alan Cohen <coh...@smh.toronto.on.ca> wrote: > I am trying to print a table with numbers all rounded to the same > number of digits (one after the decimal), but R seems to want to not > print ".0" for integers.
'round' only rounds numbers; it doesn't format them. Use 'formatC' instead. Example: > x=c(1.234, 20.31, 25, 0.7) > formatC(x, digits=1, format="f") [1] "1.2" "20.3" "25.0" "0.7" 'prettyNum' may also be useful. -- Karl Ove Hufthammer ______________________________________________ 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.