xP: Text Processing: Print Formatted Numbers

View source: R/xP.R

xPR Documentation

Text Processing: Print Formatted Numbers

Description

Prints numbers nicely formatted, with optional units. Primarily for internal use in text processing of knitr output. Not usually referenced by the user.

Usage

xP(x, d_d=NULL, unit=NULL, semi=FALSE)

Arguments

x

The variable.

d_d

The digits.

unit

Unit of measurement for the variable.

semi

Add a semicolon before the unit to add some horizontal spacing in math mode.

Details

Input is numeric, output is formatted text. A special unit is "$", which is added to the front of the number instead of as a trailing descriptor.

Author(s)

David W. Gerbing (Portland State University; gerbing@pdx.edu)

Examples

xP(12345678.9, d_d=2, unit="$")

xP(12345678.9, d_d=2, unit="lbs")

lessR documentation built on Nov. 12, 2023, 1:08 a.m.