如何在 R 降价文档中插入变量值
How to interpolate variable values in R markdown documents
是否可以在 R markdown 文档中插入 R 代码或变量值?我的意思是:
---
title: "Behavioural report"
author: "My name"
date: "Some date here"
output: pdf_document
---
```{r echo=FALSE}
X = 1.28473
```
Suppose that this is my R markdown document and I want to say that the value
of the variable X = {Here I want the value of X to appear}. And then blah...
所以我希望值 1.28473 出现在文本 'X =' 之后。
提前致谢!
尝试使用以下内容代替您的 {}
`r X`
您还可以进行内联计算:
`r mean(rnorm(50))`
是否可以在 R markdown 文档中插入 R 代码或变量值?我的意思是:
---
title: "Behavioural report"
author: "My name"
date: "Some date here"
output: pdf_document
---
```{r echo=FALSE}
X = 1.28473
```
Suppose that this is my R markdown document and I want to say that the value
of the variable X = {Here I want the value of X to appear}. And then blah...
所以我希望值 1.28473 出现在文本 'X =' 之后。
提前致谢!
尝试使用以下内容代替您的 {}
`r X`
您还可以进行内联计算:
`r mean(rnorm(50))`