Skip to contents
loading...

Scientific format for columns in {flextable}

Usage

colformat_md(
  x,
  i = NULL,
  j = NULL,
  h.sizes = c(15, 13, 9),
  h.colors = c("black", "darkgray"),
  strike = list(color = h.colors[2], underlined = FALSE),
  bullet = "·",
  code.font = "monospace",
  code.shading = "#f8f8f8",
  link.color = "blue",
  link.underline = TRUE,
  autolink = TRUE
)

Arguments

x

a flextable object

i

rows selection

j

columns selection

h.sizes

font sizes for titles

h.colors

font colors for titles

strike

a list with color and underlined = TRUE or FALSE for strikethrough text

bullet

bullet character used for lists

code.font

font used for code strings

code.shading

background color (shading) for code strings

link.color

color used for URL links

link.underline

are URL links underlined?

autolink

are links automatically constructed when there is an URL in the text?

Value

the flextable object with the selected region formatted as markdown strings.

Examples

dat <- data.frame(
  x = 1:3,
  y = noquote(c("#### text1", "text~2~", "text^3^")),
  names = noquote(c("*Iris setosa*", "Iris ~~virginica~~",
    "Iris **versicolor**")),
  id = c("*setosa*", "`virginica`", "**versicolor**"),
  factor = factor(c("*setosa*", "`virginica`", "**versicolor**"))
)
tabularise(dat)

x

y

names

id

factor

1

#### text1

*Iris setosa*

*setosa*

*setosa*

2

text~2~

Iris ~~virginica~~

`virginica`

`virginica`

3

text^3^

Iris **versicolor**

**versicolor**

**versicolor**

tabularise(dat) |> colformat_md() |> Stb$autofit()

x

y

names

id

factor

1

text1darkgray

Iris setosadarkgray

*setosa*

*setosa*

2

text2FALSE

Iris virginicaFALSE

`virginica`

`virginica`

3

text3darkgray

Iris versicolordarkgray

**versicolor**

**versicolor**

tabularise(dat) |> colformat_md(i = 2:3, j = 'names') |> Stb$autofit()

x

y

names

id

factor

1

#### text1

*Iris setosa*

*setosa*

*setosa*

2

text~2~

Iris virginicadarkgray

`virginica`

`virginica`

3

text^3^

Iris versicolorFALSE

**versicolor**

**versicolor**