ticks: Wrap text in backticks

Description Usage Arguments Value Examples

Description

Wrap text in backticks

Usage

1
ticks(..., r = FALSE)

Arguments

...

Character. Text to go between backticks, and any other arguments to be passed to glue.

r

Logical. Add r at the beginning, for R Markdown?

Value

Character. String surrounded in backticks.

ticks is a wrapper for glue, so you can use curly bracket notation and multiple character strings just like with glue.

ticks is particularly useful for R Markdown, where you don"t want to use a backtick because it would end the inline code block.

Sometimes you want to actually show an inline R code block, as text (instead of evaluating it). For that we"ve included a handy shortcut for adding the initial r .

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
ticks("foobar")
ticks("foo", "bar")
word1 <- "foo"
word2 <- "bar"
ticks("{word1}{word2} = 'stupid'", r = TRUE)
word3 <- "random"
ticks(
  "c(",
  "{word1}{word2} = 'surprisingly', ",
  "{word3} = 'painless'",
  ")",
  r = TRUE
)

BenjaminWolfe/typewritr documentation built on Nov. 23, 2019, 11:18 a.m.