pubformat: Format numbers for publication

View source: R/pubformat.R

pubformatR Documentation

Format numbers for publication

Description

Format numbers according to a specified handler function. Currently supported are sprintf, format and prettyNum.

Usage

pubformat(x, digits = 2, nsmall = digits, handler = "sprintf", ...)

Arguments

x

numeric vector

digits

number of digits

nsmall

see handler

handler

String specififying the name of the function which should perform the formatting. See sprintf, format and prettyNum.

...

Passed to handler function if applicable, i.e., not to sprintf.

Value

Formatted number

Author(s)

Thomas A. Gerds <tag@biostat.ku.dk>

See Also

sprintf, format, prettyNum

Examples


pubformat(c(0.000143,12.8,1))
pubformat(c(0.000143,12.8,1),handler="format")
pubformat(c(0.000143,12.8,1),handler="format",trim=TRUE)
pubformat(c(0.000143,12.8,1),handler="prettyNum")

Publish documentation built on Jan. 18, 2023, 1:08 a.m.