force_or_cut {prmisc}R Documentation

Print a number having a specified number of digits or as integer

Description

Print a number having a specified number of digits or as integer

Usage

force_or_cut(x, decimals = 2)

Arguments

x

A vector of numbers

decimals

The number of digits that should be printed if x is a decimal number. Defaults to 2.

Details

If x integer, only the integer is printed, if x is a decimal number, the decimals are printed

Value

Character vector of length length(x). The number(s) in the required format.

Author(s)

Martin Papenberg martin.papenberg@hhu.de

Examples


force_or_cut(c(1:3, 1.23456, 0.873, 2.3456))


[Package prmisc version 0.0.3 Index]