pct_round: Internal Function: Round numeric values and print as percent

Description Usage Arguments See Also Examples

View source: R/prepare.R

Description

This is a helper function for conveniently displaying percentages. It is used in other summary functions in salic.

Usage

1
pct_round(x, rnd = 1, scale = 100)

Arguments

x

numeric: Vector of values to display as rounded percentages

rnd

numeric: number of decimals to round pct change results

scale

numeric: scaling paramter - defaults to 100 for showing percentages

See Also

Other internal helper functions: calc_churn, format_num, print_dat

Examples

1
2
3
x <- data.frame(id = c(1,2,3,4), pop = c(135, 416, 389, 320))
x$pct <- pct_round(x$pop / sum(x$pop))
x

southwick-associates/salic documentation built on Nov. 5, 2019, 9:13 a.m.