Learn R Programming

sca (version 0.9-2)

percent: Simple Formatting of Percentages

Description

Returns strings of the same length as p, displaying the 100 * p percentages.

Usage

percent(p, d = 0, sep = " ")

Value

character vector of the same length as p.

Arguments

p

number(s) in \([0,1]\) -- to be ``displayed'' as percentage(s).

d

number of digits after decimal point.

sep

separator to use before the final "%".

Author

Martin Maechler

Examples

Run this code
percent(0.25)
noquote(percent((1:10)/10))
(pc <- percent((1:10)/30, 1, sep=""))
noquote(pc)

Run the code above in your browser using DataLab