Learn R Programming

REDCapDM (version 1.0.1)

round: Round Numbers to a Specified Number of Digits ----

Description

This function rounds numeric values to the specified number of decimal digits, mimicking the behavior of the base R round() function but implemented manually.

Usage

round(x, digits)

Value

A numeric vector rounded to the specified number of digits.

Arguments

x

A numeric vector to be rounded.

digits

Integer indicating the number of decimal places to round to.

Examples

Run this code
round(3.14159, 2)
round(c(-2.718, 3.14159), 1)

Run the code above in your browser using DataLab