1

Is it possible to interpolate R code or variable values in R markdown documents? I mean something like:

---
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...

So I want the value 1.28473 to appear just after the text 'X ='.

Thanks in advance!

user2641103
  • 704
  • 9
  • 25

1 Answers1

2

Try using the following in place of your {}

`r X`

You can also do inline computations:

`r mean(rnorm(50))`
lmo
  • 37,904
  • 9
  • 56
  • 69