pad_number: Prepare numbers for display in tables/plots

Description Usage Arguments Value Examples

View source: R/gen_tableS1.R

Description

To prepare for submission. If numbers <0.001 round to 3 significant figures and use scientific notation. If numbers are larger, round numbers to 3 significant figures and pad to right if needed (i.e. if rounding leads to 0s)

Usage

1
pad_number(x, digits = 3)

Arguments

x

A number (double)

digits

Number of significant figures to include

Value

Character string.

Examples

1
2
3
4
5
6
7
8
9
#Small numbers (negative or positive) use scientific notation.
pad_number(-0.00000047641)
pad_number(0.00000047641)

#Larger numbers do not. Use 3 significant figures
pad_number(0.0128)

#Pad out to same length for all numbers
pad_number(0.1)

LiamDBailey/baileyetal2021 documentation built on Feb. 10, 2022, 12:34 a.m.