R Markdown is a very popular choice in the field of marketing research. This package is widely used for creating automated reports and presentations for clients because it can execute R code during the rendering of a document.
R Markdown is an extension of Markdown, a lightweight markup language. Briefly speaking, Markdown inserts the most commonly used document parts (headers, lists, images, code snippets) into a document. With this plain-text-formatting syntax in a takes just a few special characters to transform plain text into rich text. R Markdown adds a compelling feature to Markdown’s standard functionality: handling of the R code!
With the help of this package, we can create reports and export them into different formats. As I’ve already mentioned, during the rendering process, we can execute R code. With this feature, it is possible to fill the document with relevant data based on complex calculations.
For example (see the picture below), with the help of R Markdown, I have generated a comparison between the results of Nebu's demo coffee questionnaire between the years 2019 and 2020. The comparison is a PDF file. You can access this file by clicking on the links or the picture below. In the questionnaire, we were asking respondents' preferences in regards to how they like to drink their coffee. It is a clean, slick-looking document that holds some real data, structured to my liking with the help of R.
Results you can see on the first page of the document are displayed in descending order by popularity. The colored arrows show whether the order changed between the two years. On the second page (which screenshot you see below), I compare the actual differences in the percentage of given answers between 2019 and 2020.
A comparison of the survey results between the year 2019 and 2020 generated as an R Markdown pdf
(Click on the picture above to see the entire PDF document)
Styling the document may be a little trickier than dealing with R itself. R Markdown doesn’t provide too many styling options out of the box. However, depending on the document format, other techniques can be used to make the result look just like you want it. For creating interactive, Html files some HTML and CSS knowledge is required. If you do not have that knowledge or resources, don't worry. We can provide you support in creating proper codes. The focus of this post is on creating PDF files. Those can be customized using LaTeX, which is a widely used text formatting language. Inserting LaTeX commands into the R Markdown source file reduces readability, but to create nice looking PDFs it’s a must.
This above infographic is full of quotes that are identical in style. The only differences between them are their contents and positions. Inserting them is handled by an R script, which generates the LaTeX commands and inserts them into the R Markdown source file based on the defined parameters.
On the picture below, you see an R Markdown auto-generated visual representation of a sentiment score. The calculation has been taken directly from our NPS coffee questionnaire's results, and verbatims representing a particular score, carefully auto-selected with a series of conditions checked in the background.
R Markdown is a very popular choice in the field of marketing research. It is widely used for creating automated reports and presentations for clients.
Let’s have a look at the following example: a PDF with a visual recap of survey results generated with a script (click here or on the picture below to see the entire presentation.)
You might wonder whether it is worth the effort to have documents and presentations prepared with a script. The answer is yes! And there are at least three significant reasons why.
Reason number one: You only have to prepare a base code once, and from there, you can use it to multiple projects, only adjusting the datasource, variable names and some basic look and feel options.
Reason number two: After the initial effort, you start to save a lot of time having a process set in place instead of having to create a new document from scratch each time.
Reason number three: In the case of our ongoing longitudinal demo project, we still have almost half of 2020 left to collect responses. The results you see right now will likely change, perhaps even significantly. Using the Nebu Data Hub we can simply create an automated process that runs this script every day (week, month, etc.) and keeps this document up to date. This way, without any further effort, you or any stakeholder will always have access to the most recent results.
Even though R is becoming a default programming language at universities nowadays, still not everyone has the skills to work with R. Obviously it is not necessary for everyone in the organization to know this programming language. R is so efficient that even one person working with it can make a huge difference across an entire company. You can use some of ready-to-use R scripts we have prepared for our clients, write your own, or easily outsource the creation of scripts with our technology partners.
If you want to learn more about Nebu Data suite and how it can help you automate processes and increase work efficiency submit a form to the right. Our expert will reach out soon to schedule a call!
Roode Wildemanweg 19
1521 PZ Wormerveer
T +31 251 311 413
UK Sales: +44 33 080 87820
US Sales: +1 347 708 1633
Submit a commment