Given a single numeric vector or factor, will compute no. equal to a .referent value and percent of total, returning results in string. Mostly called by other functions.

num_fctr(x, .digits=2, .referent = TRUE)

Arguments

x

A numeric or factor class vector

.digits

Significant figures to round to

.referent

Value to compute no. (percent) for

Value

A character string of length 1, 'No. (percent)'

Examples

require(Scotty) num_fctr(mtcars$cyl, .referent=4)
#> [1] "11 (34.4%)"