Learn R Programming

jwutil (version 1.2.3)

npc: Print integers with percentage of total rounded to integer

Description

Intended for succinctly printing summary data in a scientific publication.

Usage

npc(x, n, fmt = "%d (%s)")

Arguments

x

numeric number

n

numeric total

fmt

sprintf format, default being %d (%s)

Examples

Run this code
# NOT RUN {
npc(1, 100)
npc(1, 1)
npc(2, 1)
npc(1.321, 7.7432)
npc(7239, 234897)
npc(-10, 1000)
# }

Run the code above in your browser using DataLab