How to display verbatim inline r code with backticks using Rmarkdown?

后端 未结 5 520
广开言路
广开言路 2020-12-08 19:49

By doubling the backticks in Markdown, it is easy to render some text in code style including the backticks, such as: `r 2+2`. But how to do that with RMark

5条回答
  •  情话喂你
    2020-12-08 20:22

    To anyone looking at this now, you may want to check out the more recent solution here: embed Rmarkdown without knitr evaluation

    Essentially you can do:

    Some R code inline : `r knitr::inline_expr("2+2")`
    

    I'm guessing that the functionality describe above has been added to knitr directly but it saves us defining the function ourselves.

提交回复
热议问题