style_numeric: Style Numeric

Description Usage Arguments Examples

View source: R/style_numeric.R

Description

Take a dataframe, round the digits to the thousandths, and optionally add commas (except to year columns).

Usage

1
2
style_numeric(df, digits = 3, add_commas = FALSE,
  dont_add_commas = NULL)

Arguments

df

A dataframe.

digits

The number of digits to round decimals to.

add_commas

If TRUE, add commas in between 1000s.

dont_add_commas

A character vector of columns that should not have commas added, if add_commas is TRUE.

Examples

1
2
3
iris_2 <- iris %>% tibble::as_tibble()
iris_2$Sepal.Width <- iris$Sepal.Width*1e+12
iris_2 %>% style_numeric(add_commas = TRUE)

aedobbyn/dobtools documentation built on May 28, 2019, 2:33 a.m.