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 ---------------------------------------------------------------------------- -------------------------- Thanks R-Helpers. Yes, this is a silly question and it will not be repeated! :-)
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
On Nov 10, 2010, at 5:13 AM, Jim Lemon wrote:> 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 %?> sprintf("%1.0f %%",10) [1] "10 %" > sprintf("%1.0f%%",10) [1] "10%">> >>> 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