[R] format as percentage

Jim Lemon jim at bitwrit.com.au
Wed Nov 10 11:13:39 CET 2010


On 11/10/2010 07:55 PM, Santosh Srinivas wrote:
> Basic question ... checked the help page but the only answer was to use
> paste!
> Is there any way to format as %?
>
>> degree = c(0.20,0.5)
>> degree
> [1] 0.2 0.5
>> print(degree)
> [1] 0.2 0.5
>
Hi Santosh,
If you want to scale proportions to percentages, you probably want this:

paste(100*degree,"%")

You may also have to look at rounding the result to avoid those awful

27.29387163%

outcomes.

Jim



More information about the R-help mailing list