round_df: round_df

Description Usage Arguments Value Examples

View source: R/round_df_function.R

Description

This function rounds the numeric variables in a dataframe containing numeric and non-numeric data

Usage

1
round_df(x, digits)

Arguments

x

dataframe

digits

digits to round to

Value

Dataframe with rounded numbers

Examples

1
2
3
4
5
6
7
8
##Create dataframe
ID = c("a","b","c","d","e")
Value1 = c(3.445662,6.44566,8.75551,1.114522,1.5551)
Value2 = c(8.2,1.7,6.4,19.45459,10.34524)
df<-data.frame(ID,Value1,Value2)

##Round to 2 digits
rounddf<-round_df(df,2)

ITNr documentation built on March 13, 2020, 1:48 a.m.

Related to round_df in ITNr...