【问题标题】:Inline code in r markdown is printed 'as is'r markdown 中的内联代码按“原样”打印
【发布时间】:2019-03-11 20:42:30
【问题描述】:

在编织 R Markdown 文档时,内联代码按“原样”打印,例如:

- The number of patients in the dataframe is `n_distinct(med1$patients)`.

编织的一模一样:

  • 数据框中的患者数量为n_distinct(med1$patients)

不评估代码,而是将文本格式化为代码。在上一个问题中,有人建议添加括号,但它对我不起作用。
任何建议将不胜感激。

【问题讨论】:

标签: r r-markdown knitr


【解决方案1】:

我偶然发现了解决方案。我不得不这样写:

  • 数据框中的患者数量为 `r n_distinct(med1$patients)`。

代码中的额外 R 使其按需要运行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-06
    • 1970-01-01
    • 1970-01-01
    • 2018-12-02
    • 1970-01-01
    • 2021-05-16
    • 2021-08-24
    相关资源
    最近更新 更多