Learn R Programming

oeli (version 0.7.1)

round_data.frame: Round numeric columns of a data.frame

Description

This function rounds (only) the numeric columns of a data.frame.

Usage

round_data.frame(df, digits = 0)

Value

A data.frame.

Arguments

df

[data.frame]
A data.frame.

digits

[integer(1) | NULL ]
The number of decimal places to be used.

Negative values are allowed, resulting in rounding to a power of ten.

Can be NULL to not round.

See Also

Other data.frame helpers: delete_columns_data.frame(), group_data.frame()

Examples

Run this code
df <- data.frame("label" = c("A", "B"), "number" = rnorm(10))
round_data.frame(df, digits = 1)

Run the code above in your browser using DataLab