df.round: Data Frame Rounding of Numbers

View source: R/df.round.R

df.roundR Documentation

Data Frame Rounding of Numbers

Description

This function rounds all numeric columns in a data frame.

Usage

df.round(data, ..., digits = 2, drop = FALSE, check = TRUE)

Arguments

data

a data frame.

...

an expression indicating the variable names in data, e.g., df.round(dat, x1, x2, x3). Note that the operators +, -, ~, :, ::, and ! can also be used to select variables, see 'Details' in the df.subset function.

digits

an integer value indicating the number of decimal places to be used.

drop

logical: if TRUE, non-numeric columns are dropped from the data frame.

check

logical: if TRUE (default), argument specification is checked.

Value

Returns data frame data with numeric columns rounded to the number of decimal places according to the argument 'digits'.

Author(s)

Takuya Yanagida takuya.yanagida@univie.ac.at

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

See Also

df.check, df.duplicated, df.unique, df.head, df.tail, df.long, df.wide, df.merge, df.move, df.rbind, df.rename, df.sort, df.subset

Examples

# Example 1: Round numeric columns with 0 digits
df.round(penguins, digits = 0)

# Example 2: Round numeric columns with 0 digits and drop non-numeric columns
df.round(penguins, digits = 0, drop = TRUE)

misty documentation built on Nov. 24, 2026, 5:06 p.m.

Related to df.round in misty...