A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://davidgohel.github.io/flextable/reference/set_formatter.html below:

Set column formatter functions — set_formatter • flextable

Apply formatter functions to column keys.

Functions should have a single argument (the vector) and should return the formatted values as a character vector.

Usage
set_formatter(x, ..., values = NULL, part = "body")
Arguments
x

a flextable object

...

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

values

format functions, If values is supplied argument ... is ignored.

part

part of the table (one of 'body' or 'header' or 'footer') where to apply the formatter functions.

Examples
ft <- flextable(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

           

Sepal.Length

Sepal.Width

Petal.Length

Petal.Width

Species

5.10

3.5000

1.4

0.2

setosa

4.90

3.0000

1.4

0.2

setosa

4.70

3.2000

1.3

0.2

setosa

4.60

3.1000

1.5

0.2

setosa

5.00

3.6000

1.4

0.2

setosa

5.40

3.9000

1.7

0.4

setosa


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4