startz
March 29, 2021, 4:48pm
1
I want to show R Markdown in slides for my students. Is there a way to mark material to be displayed as it appears in the RMD file, rather than as instructions as to how to knit?
For example, I might want
# A Header
to appear just like that, including the hash tag and in blue rather than generating a new header.
Probably obvious, but not to me...
startz
March 29, 2021, 7:24pm
3
Very helpful. Thanks.
Can I ask whether the inclusion of "md" is part of the code or just a useful comment?
jdb
March 29, 2021, 7:25pm
4
It's what causes it to be interpreted as Markdown, like you see with R chunks
```{r}
# your code here
```
startz
March 29, 2021, 7:26pm
5
Got it. Thanks once more.
startz
March 29, 2021, 8:07pm
6
One more piece...
I also want to be able to include the R code blocks including the surrounding {r}...
and backquotes. For example,
```{r setup, include=FALSE}
> knitr::opts_chunk$set(echo = TRUE, comment = NULL, options(width = 58))
startz
March 29, 2021, 9:17pm
7
The answer to my question appears to be to use a "verbatim code chunk." While a little kludgey, this is explained in The R Markdown Cookbook at https://bookdown.org/yihui/rmarkdown-cookbook/verbatim-code-chunks.html .
1 Like
cderv
April 6, 2021, 10:04am
8
If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:
If your question has been answered, don't forget to mark the solution!
How do I mark a solution?
Find the reply you want to mark as the solution and look for the row of small gray icons at the bottom of that reply. Click the one that looks like a box with a checkmark in it:
[image]
Hovering over the mark solution button shows the label, "Select if this reply solves the problem". If you don't see the mark solution button, try clicking the three dots button ( ••• ) to expand the full set of options.
When a solution is chosen, the icon turns green and the hover label changes to: "Unselect if this reply no longer solves the problem". Success!
[solution_reply_author]
…
startz
April 6, 2021, 3:26pm
9
Done. Clearly good etiquette. Thanks for pointing this out to me.
1 Like
system
Closed
April 13, 2021, 3:26pm
10
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.