How do I add an HTML meta tag within the head of an RMarkdown HTML output file from RStudio?
In particular I am trying to insert the following to over come IE compatibility issues on our intranet.
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
</head>
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.
If you prefer to use the console by default for all your R Markdown documents (restoring the behavior in previous versions of RStudio), you can make Chunk Output in Console the default: Tools -> Options -> R Markdown -> Show output inline for all R Markdown documents .
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).
You can embed an R code chunk like this: ```{r} summary(cars) ``` You can also embed plots, for example: ```{r, echo=FALSE} plot(cars) ``` ### Header 3 Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot. I tried running this in RStudio v 0.98.
Use library(metathis)
!
Then include with:
```{r include=F}
meta() %>%
meta_description("My awesome App")
```
And any other meta tag
You can create a file with the meta tag and add using the following YAML option:
---
title: "mytitle"
output:
html_document:
includes:
in_header: myheader.html
---
You could also create the myheader.html
file on the fly in the setup chunck:
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE )
#libraries
require(ggplot2)
#Create myheader.html
fileConn <- file("myheader.html")
writeLines('<meta http-equiv="X-UA-Compatible" content="IE=edge" />', fileConn)
close(fileConn)
```
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With