percent: Designate a numeric vector as a percent.

Description Usage Arguments Value Functions Examples

View source: R/percent.R

Description

The percentage is stored as a formatted string with the original value as an attribute. The formatted value is what will most often be needed but but allows for the original value to be recovered when the attribute is not stripped off.

Usage

1
2
3
4
5
percent(x, ...)

pct(x, places = attr(x, "places") %||% getOption("percent::places", 2),
  threshold = attr(x, "threshold") %||% getOption("percent::threshold",
  1 * 10^-places), ...)

Arguments

x

a numeric object indicating a percentage.

...

additional formatting arguments.

places

Places to show after the decimal point.

threshold

The minimum absolute percentage to show.

Value

Functions

Examples

1
2
3
pct(2/3)           #<-- no class
(x<- percent(2/3)) #<-- has class
as.numeric(x)

cursory documentation built on Aug. 22, 2019, 9:03 a.m.