.numformat {EFAtools}R Documentation

Format numbers for print method

Description

Helper function used in the print method for class LOADINGS and SLLOADINGS. Strips the 0 in front of the decimal point of a number if number < 1, only keeps the first digits number of digits, and adds an empty space in front of the number if the number is positive. This way all returned strings (except for those > 1, which are exceptions in LOADINGS) have the same number of characters.

Usage

.numformat(x, digits = 2, print_zero = FALSE)

Arguments

x

numeric. Number to be formatted.

digits

numeric. Number of digits after the comma to keep.

print_zero

logical. Whether, if a number is between [-1, 1], the zero should be omitted or printed (default is FALSE, i.e. omit zeros).

Value

A formated number


[Package EFAtools version 0.4.4 Index]