Formatting and publishing code using R Markdown
We have now reached the part of the chapter where we focus on delivering the fruits of our labor to our consumers, who will take this information back to their users and produce actionable intelligence from it. In order for them to do this, we need to deliver our results inside of a dynamic report. RStudio allows us to do this with R Markdown, which is a format that allows for reproducible reports with embedded R code that can be published into slide shows, Word documents, PDF files, and HTML web pages.
Getting started with R Markdown
R Markdown documents have theĀ .RMD
extension and are created by selecting R Markdown from the menu bar of RStudio, as seen here:
If this is the first time you are creating an R Markdown report, you may be prompted to install some additional packages for R Markdown to work, as seen in the following screenshot:
Once the packages are installed, we can define a title, author, and default output format, as follows...