In this chapter, we will cover the following topics:
rmarkdown
tufte
package and rmarkdown
In this chapter, we will provide tools for the last part of your data-analysis project: result sharing. This is a relevant phase since your work will give no added value if you do not effectively communicate it.
You know this is true, but how do you do it?
The answer to this question can be split into two parts:
Let’s first briefly address the first part, since the second one will be addressed throughout the chapter. Talking about the marketing part, I refer to all those strategies and activities you perform to sell your product better. Your product is your job, and if you don’t sell it properly, nobody is going to buy it and you would have wasted your time.
This is not the right place to address the point in a proper and complete way, but let me stress at least two points:
Let’s face the technical part now. In the modern world, the more precious resource is time. It is therefore considered a waste of time copying and pasting results from your job into a file external to your coding environment, and copying and pasting it again when even a small detail changes.
This process can also be considered error prone. Within your copy-and-paste activity, you can bet a considerable sum on forgetting to update some values and sending your boss outdated numbers. This, as we know, is not a pleasant experience.
This chapter will help you avoid such unpleasant scenarios and give you great tools to develop reports on your work directly from the place where it was produced: RStudio. In this chapter, you will learn how to develop reports directly by embedding numbers, plots, and data frames from your code. When you change the code and outputs change, your report will change by itself.
Doesn’t it sound like a dream?
Our best friend in this chapter, and part of the next one as well, will be rmarkdown, a powered markup language. It lets you embed and execute pieces of R code within documents written in the Markdown language, the popular markup language created by Joghn Gruber in 2004. We will employ rmarkdown in this chapter to write reports, PDF documents, and tufte handouts. We will also use rmarkdown to curate a blog directly from your favorite IDE.