Nothing
knitr::opts_chunk$set(collapse = TRUE, comment = "#>", fig.width = 7, fig.height = 5, warning = FALSE, message = FALSE) if (!requireNamespace("rmarkdown", quietly = TRUE) || !requireNamespace("htmltools", quietly = TRUE)) { knitr::opts_chunk$set(eval = FALSE, tidy = FALSE) }
This file shows a typical workflow for knitting .Rmd documents and sending them per E-Mail.
First we have our my_file.Rmd which looks like this:
````{=html}
````
title: ' ' output: html_document: theme: null highlight: null mathjax: null
Hello everyone,\n
here is a calculation.
2+2 =
``{r echo=FALSE} 2+2
``All the best
test.Rmd <- "--- title: ' ' output: html_document: theme: null highlight: null mathjax: null --- Hello everyone,\n here is a calculation. **2+2 =** \```r 2+2 \``` All the best " writeLines(test.Rmd, con = "my_file.Rmd")
htmlout <- tempfile(fileext = ".html") rmarkdown::render( input = "my_file.Rmd", intermediates_dir = ".", output_file = htmlout, )
unlink("my_file.Rmd") htmltools::includeHTML(htmlout)
We can now send the the resulting html file as A) an file attachment or B) inline HTML.
library(sendmailR) sendmail(from="from@example.org", to="to1@example.org", subject="File attachment", msg=c( mime_part("Hello everyone,\n here is the newest report.\n Bye"), mime_part(htmlout, name = "report.html")), engine = "debug")
sendmail(from="from@example.org", to="to1@example.org", subject="Inline HTML", msg=mime_part_html(htmlout), engine = "debug")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.