Learn R Programming

papaja (version 0.1.0.9655)

printnum: Prepare numeric values for printing

Description

Converts numeric values to character strings for reporting.

Usage

printnum(x, gt1 = TRUE, zero = TRUE, margin = 1,
  na_string = getOption("papaja.na_string"), ...)

printp(x, na_string = "")

Arguments

x

Numeric. Can be either a single value, vector, or matrix.

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.

...

Further arguments that may be passed to formatC

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
# NOT RUN {
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