TransWikia.com

Brackets in .Rmd code blocks

Bioinformatics Asked by Angus Campbell on June 5, 2021

I am making some R markdown documents for my stats class. I’ve noticed I get an error in some functions when I have a code block with {r} instead of just r. Like so…

``` r
this code will be fine
``` 

``` {r}
this code will have an error
```

When should I be using the brackets for codeblocks in .Rmd and when should I leave them out?

One Answer

Does it work without a space between the ``` and the {r}? It may be that the Rmd processor is getting confused about the spaces, but ignoring the bare r, and assuming the code is R by default.

The examples here don't have spaces:

https://rmarkdown.rstudio.com/lesson-3.html

Answered by gringer on June 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP