Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

format_df

Format a data.frame with a specified number of decimal places


Description

Format a data.frame with a specified number of decimal places

Usage

format_df(tbl, dec = NULL, perc = FALSE, mark = "", na.rm = FALSE, ...)

Arguments

tbl

Data.frame

dec

Number of decimals to show

perc

Display numbers as percentages (TRUE or FALSE)

mark

Thousand separator

na.rm

Remove missing values

...

Additional arguments for format_nr

Value

Data.frame for printing

Examples

data.frame(x = c("a", "b"), y = c(1L, 2L), z = c(-0.0005, 3)) %>%
  format_df(dec = 4)
data.frame(x = c(1L, 2L), y = c(0.06, 0.8)) %>%
  format_df(dec = 2, perc = TRUE)
data.frame(x = c(1L, 2L, NA), y = c(NA, 1.008, 2.8)) %>%
  format_df(dec = 2)

radiant.data

Data Menu for Radiant: Business Analytics using R and Shiny

v1.3.12
AGPL-3 | file LICENSE
Authors
Vincent Nijs [aut, cre]
Initial release
2020-11-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.