Formating the Rounding of Numbers

Share:

Description

fround rounds the values in its first argument to the specified number of decimal places with surrounding quotes.

pfround rounds the values in its first argument to the specified number of decimal places without surrounding quotes.

Usage

1
2
fround(x, digits)
pfround(x, digits)

Arguments

x

a numeric vector.

digits

integer indicating the precision to be used.

Author(s)

Andrew Gelman gelman@stat.columbia.edu; Yu-Sung Su suyusung@tsinghua.edu.cn

See Also

round

Examples

1
2
3
    x <- rnorm(1)
    fround(x, digits=2)
    pfround(x, digits=2)