Learn R Programming

radiant.data (version 0.8.1)

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

Description

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

Usage

formatdf(tbl, dec = 3, perc = FALSE, mark = "")

Arguments

tbl

Data.frame

dec

Number of decimal places

perc

Display numbers as percentages (TRUE or FALSE)

mark

Thousand separator

Value

Data.frame for printing

Examples

Run this code
# NOT RUN {
data.frame(x = c("a","b"), y = c(1L, 2L), z = c(-0.0005, 3)) %>%
  formatdf(dec = 3)
data.frame(x = c(1L, 2L), y = c(0.05, 0.8)) %>%
  formatdf(dec = 2, perc = TRUE)

# }

Run the code above in your browser using DataLab