[R] Expressing number in percentage
Marc Schwartz
marc_schwartz at comcast.net
Thu Sep 27 16:56:05 CEST 2007
On Thu, 2007-09-27 at 14:36 +0100, stat stat wrote:
> I am wondering if there is any procedure to write a particular value
> in Percentage format, still maintaining it's numeric character. for
> example I want to write '.33' as '33%'
See ?sprintf
> sprintf("%.0f%%", .33 * 100)
[1] "33%"
Note that the trailing '%' needs to be doubled to be recognized as the
character and not a format specifier.
HTH,
Marc Schwartz
More information about the R-help
mailing list