round_text {plothelper}R Documentation

Converting Numeric Values into Characters with the Same Digits

Description

This simple function is to facilitate something like decimal horizontal adjustment which demands each value has the same digits after the decimal point.

Usage

round_text(x, digits = 2, na = NULL)

Arguments

x

a vector of numeric values.

digits

digits which is to be passed to round. It should not be smaller than 0.

na

how to show NAs. The default is to show " NA", however, you can change it to "NA" or simply NA.

Examples

v=c(3, 3.1, 3.456, 3.452, 3.77, NA, 0, 10.56332)
res=round_text(v, 2, na=NA)

[Package plothelper version 0.1.9 Index]