Answers.Body: <p>Does it work without a space between the <code>```</code> and the <code>{r}</code>? It may be that the Rmd processor is getting confused about the spaces, but ignoring the bare <code>r</code>, and assuming the code is R by default.</p>
  <p>The examples here don't have spaces:</p>
  <p><a href="https://rmarkdown.rstudio.com/lesson-3.html" rel="nofollow noreferrer">https://rmarkdown.rstudio.com/lesson-3.html</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-05T22:21:34.430Z
Answers.Text: Thank you I believe you may be right.  I am having other problems with my code.
Answers.UserDisplayName: Angus Campbell
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-05T02:35:11.433Z
Answers.LastActivityDate: 2021-03-05T02:35:11.433Z
Answers.UserDisplayName: gringer
Body: <p>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...</p>
  <pre><code>``` r
  this code will be fine
  ``` 
  
  ``` {r}
  this code will have an error
  ```
  </code></pre>
  <p>When should I be using the brackets for codeblocks in .Rmd and when should I leave them out?</p>
  
Tags: <r>
Title: Brackets in .Rmd code blocks
ThreadText: # Brackets in .Rmd code blocks
  
  (Asked by: username_0 on 2021-03-04)
  
  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?
  
  **Tags:** r
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-03-05. Score: 2 | Accepted 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>
  
  > **Comments:**
  > **username_0**: Thank you I believe you may be right.  I am having other problems with my code.  
  
  ---
  
  