mround: shortcut for round

Description Usage Arguments Details Value Author(s) Examples

View source: R/functions.R

Description

shortcut for round with some nice advantage for writing. It does not loose the trailing zeros and add digits when necessary, or return the number in scientific notation when too many (12) digits are necessary to represent the first significant digit.

Usage

1
mround(x, digits=2)

Arguments

x

a object of class numeric

digits

number of digits to print

Details

This function is a modification of Karl Broman myround function https://github.com/kbroman/broman/blob/master/R/myround.R Returns the value rounded at the indicated number of digits, preserving extra zeros and adding digists when necessary

Value

a numeric value

Author(s)

Marcello Gallucci

Examples

1
2
3
4
5
a<-.0809474782344
mround(a)
mround(0.8,digits=3)
mround(0.00008)
mround(0.000000000000000000000000000008)

mcfanda/StatWriter documentation built on May 22, 2019, 3:01 p.m.