R Markdown: how make I make inline code do not execute?

Viewed 467

I want to write something like I used lm() function in R in R markdown and I wish to make the lm() stand out as it is a code.

I tried to use I used `r lm()` function method to make lm() stands out, but it won't work as the program keeps telling me that lm() needs a parameter.

Is there a way I can force the inline code just display and do not execute? Thank you!

1 Answers

Just remove the r call.

Example (.Rmd file):

---
title: "Untitled"
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown

I used the `lm()` function.

Output:

enter image description here

Related