Learn R Programming

papaja (version 0.1.0.9054)

printnum: Prepare numeric values for printing

Description

Converts numeric values to character strings for reporting.

Usage

printnum(x, digits = 2, gt1 = TRUE, zero = TRUE, margin = 1, na_string = "")
printp(x, na_string = "")

Arguments

x
Numeric. Can be either a single value, vector, or matrix.
digits
Integer. Number of decimal places to print.
gt1
Logical. Indicates if the absolute value of the statistic can, in principal, greater than 1.
zero
Logical. Indicates if the statistic can, in principal, be 0.
margin
Integer. If x is a matrix, the function is applied either across rows (margin = 1) or columns (margin = 2).
na_string
Character. String to print if element of x is NA.

Functions

  • printp: Convenience wrapper for printnum to print p-values with three decimal places.

Details

If x is a vector, digits, gt1, and zero can be vectors according to which each element of the vector is formated. Parameters are recycled if length of x exceeds length of the parameter vectors. If x is a matrix, the vectors specify the formating of either rows or columns according to the value of margin.

Examples

Run this code
printnum(1/3)
printnum(1/3, gt1 = FALSE)
printnum(1/3, digits = 5)

printnum(0)
printnum(0, zero = FALSE)

printp(0.0001)

Run the code above in your browser using DataLab