Reputation: 31
While knitting an R markdown document the inline code is printed 'as is', for example:
- The number of patients in the dataframe is `n_distinct(med1$patients)`.
Is knitted exactly the same:
- The number of patients in the dataframe is
n_distinct(med1$patients)
.
The code is not evaluated, rather the text is formatted as code. In a previous question someone suggested adding brackets but it doesn't work for me.
Any suggestions will be much appreciated.
Upvotes: 1
Views: 628
Reputation: 31
I stumbled across the solution. I had to write it this way:
- The number of patients in the data frame is `r n_distinct(med1$patients)`.
With the extra R in the code made it run as desired.
Upvotes: 2