hyperlink_text {flextable}R Documentation

hyperlink wrapper

Description

The function has to be used with function display(). It lets add hyperlinks within flextable.

Usage

hyperlink_text(url, label = url)

Arguments

url, label

url and label to be used

See Also

display

Examples

dat <- data.frame(
  col = "CRAN website", href = "https://cran.r-project.org",
  stringsAsFactors = FALSE)

ft <- flextable(dat)
ft <- display(
  ft, col_key = "col", pattern = "# {{mylink}}",
  formatters = list(mylink ~ hyperlink_text(href, col) )
)
ft


dat <- data.frame(
  col = "Google it",
  href = "https://www.google.fr/search?source=hp&q=officer+R+package",
  stringsAsFactors = FALSE)

ft <- flextable(dat)
ft <- display( x = ft,
  col_key = "col",
  pattern = "This is a link: {{mylink}}",
  formatters = list(mylink ~ hyperlink_text(href, col) ) )
ft

[Package flextable version 0.4.5 Index]