Gmail, R and sending email with blastula


How do you share your R analyses with others? R Markdown is one good way, because it’s easy to mix text narrative, calculation results, and graphics. But how do you share your R Markdown documents with colleagues?

You might post them somewhere, email them as attachments, or use RStudio Connect (a commercial product) to share them. Or, you can turn an R Markdown document into an email message, and send it in the body of your email, right from R – ggplot graphs included. That’s thanks to the blastula package from RStudio.

Here’s how it works.

First, not surprisingly, install and load the package with install.packages("blastula") or remotes::install_github("rstudio/blastula").

Create an email message with blastula

There are two ways to create an email with blastula. My favorite is to start with an R Markdown document. Use blastula::blastula_email as the output format, make sure to include a title, and you’re ready to go. The other way is to use blastula’s compose_email() function, which requires more manual coding for more than a simple text email. For this demo, I’ll use R Markdown.

I suggest creating an empty document in RStudio by going to File > New File > R Markdown and clicking on the Create Empty Document button.

Copyright © 2021 IDG Communications, Inc.



Source link