ipmisc (version 1.2.0)

specify_decimal_p: Formatting numeric (p-)values

Description

Function to format an R object for pretty printing with a specified (k) number of decimal places. The function also allows really small p-values to be denoted as "p < 0.001" rather than "p = 0.000". Note that if p.value is set to TRUE, the minimum value of k allowed is 3. If k is set to less than 3, the function will ignore entered k value and use k = 3 instead. Important: This function is not vectorized.

Usage

specify_decimal_p(x, k = 3, p.value = FALSE)

Arguments

x

A numeric value.

k

Number of digits after decimal point (should be an integer) (Default: k = 3).

p.value

Decides whether the number is a p-value (Default: FALSE).

Value

Formatted numeric value.

Examples

Run this code
# NOT RUN {
specify_decimal_p(x = 0.00001, k = 2, p.value = TRUE)
specify_decimal_p(x = 0.008, k = 2, p.value = TRUE)
specify_decimal_p(x = 0.008, k = 3, p.value = FALSE)
# }

Run the code above in your browser using DataCamp Workspace