Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using in line r code as part of a R markdown header

I wish to use in line R code as part of a header in a r markdown file. However when i knit the file the fonts used on the header are different. How can I ensure the fonts are the same. A simple example is below.

`r 1+1`  Header 
-------------------------
like image 803
user2101601 Avatar asked Feb 23 '13 04:02

user2101601


People also ask

How is inline code embedded in R markdown?

Code results can be inserted directly into the text of a . Rmd file by enclosing the code with `r ` .

How do I put the R code in Markdown?

You can insert an R code chunk either using the RStudio toolbar (the Insert button) or the keyboard shortcut Ctrl + Alt + I ( Cmd + Option + I on macOS).

How do you write inline code in Markdown?

You can either use inline code, by putting backticks (`) around parts of a line, or you can use a code block, which some renderers will apply syntax highlighting to.

How do you add a header in R markdown?

We can insert headings and subheadings in R Markdown using the pound sign # . There are six heading/subheading sizes in R Markdown. The number of pound signs before your line of text determines the heading size, 1 being the largest heading and 6 being the smallest.


1 Answers

You can wrap content in backticks to denote r code inline, as follows:

## Title `r 1+1` Header
like image 128
Brandon Bertelsen Avatar answered Oct 16 '22 23:10

Brandon Bertelsen