mround {stevemisc} | R Documentation |
Multiply a Number by 100 and Round It (By Default: 2)
Description
mround()
is a convenience function I wrote for my annotating bar charts that I make.
Assuming a proportion variable, mround()
will multiply each value by 100 and round it for presentation.
By default, it rounds to two. The user can adjust this.
Usage
mround(x, d = 2)
Arguments
x |
a numeric vector |
d |
the number of decimal points to which the user wants to round. If this is not set, it rounds to two decimal points. |
Details
This is a sister function of make_perclab()
in the same package. This, however, won't add a percentage sign.
Value
The function takes a numeric vector, multiplies it by 100, rounds it (to two digits by default), and returns it to the user.
Examples
x <- runif(100)
mround(x)
mround(x, 2) # same as above
mround(x, 3)
[Package stevemisc version 1.7.0 Index]