r - 如何在 R Markdown 表中包含存储的值?
问题描述
R Markdown 初学者在这里。有没有办法可以在 R 降价表中包含存储的值?例如,假设我有价值
x <- 20
如何在这样的表中包含 x:
| Col1 | Col2 |
|:----------------|:--------------------:|
| Row1 | [where x should be] |
只是写 x 显然会在编织后返回字母,而不是所需的值。任何帮助表示赞赏,干杯!
解决方案
这是一个显示使用反引号的可重现示例。
---
title: "Variables in tables"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
x = 1
cell = 'hello world'
```
## R Markdown
First Header | Second Header
------------- | -------------
`r cell` | Content Cell
Content Cell | `r x`
推荐阅读
- python - 在浏览器中查看 Dash App 时 Heroku 应用程序部署错误
- sql - PolyBase创建外部表查询Hadoop,列数不匹配
- c++ - 调整大小时没有重载函数的实例
- r - 多元多元回归的 VIF 检验
- reactjs - 当容器中的输入值更改时,不会记录 HOC 内部的 ComponentDidUpdate
- c++ - 如何过滤pcl中给定3d(一般)平面之前的所有点
- c - 比较相似的数据类型无效?
- javascript - 如何在 vuejs 中渲染一个复杂的数组?
- c# - Blazor 组件在控制器返回 401 时引发异常
- plotly - 在 Dash 中为 Julia 制作子图