Learn R Programming

flextable (version 0.3.0)

set_formatter: set column formatter functions

Description

Define formatter functions associated to each column key. Functions have a single argument (the vector) and are returning the formatted values as a character vector.

Usage

set_formatter(x, ..., part = "body")

Arguments

x

a flextable object

...

Name-value pairs of functions, names should be existing col_key values

part

partname of the table (one of 'body' or 'header')

Examples

Run this code
# NOT RUN {
ft <- regulartable( head( iris ) )
ft <- set_formatter( x = ft,
        Sepal.Length = function(x) sprintf("%.02f", x),
        Sepal.Width = function(x) sprintf("%.04f", x)
      )
ft <- theme_vanilla( ft )
ft
# }

Run the code above in your browser using DataLab