For example, I want to be able to do "The result is ...." and have the ... be replaced with the r output. I considered using "cat", but it is not as neat.
Here is another example of what I wish to achieve.
```{r, echo=FALSE}
x <- rnorm(100, 0, 2)
a<- mean(x)
```
The result of running a random number generator from a normal distribution with mean 0 and sd 2 has a mean of (somehow output variable a).
Any suggestions?
Use backticks with a leading r, for instance:
2 + 2 = `r 2+2`.
or in your case,
the result is `r a`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With