pct: Calculates and nicely prints percent values based on two...

View source: R/pct.R

pctR Documentation

Calculates and nicely prints percent values based on two arguments

Description

This function is especially useful when used in Rmarkdown documents.

Usage

pct(x, total, digits = 1, trailing = TRUE)

Arguments

x

Numerator

total

Denominator

digits

Digits to display after decimal point

trailing

Whether trailing zeroes should be displayed

Value

A character object

Examples


pct(10, 100)
#"10.0%"
pct(10, 100, trailing = FALSE)
#"10%"

bsurial/bernr documentation built on Nov. 7, 2022, 1:41 a.m.