Data Report Instructions
Each module culminates in the creation of a data report using R Markdown. This report will act as a hands-on demonstration of your understanding of the corresponding module’s material, showcasing your ability to process, visualize, and interpret economic data.
The data report must be at least four pages in length and should include both data visualizations and interpretations. The specific content requirements will vary by module, with details provided in each respective module section. For instance, the data report on stock returns of Module A calls for the visualization and interpretation of stock return data.
Versions of the Data Report
You’ll need to complete two versions of the data report:
- An official version for your customer or supervisor, without R code. For an example, see www.julianfludwig.com/teaching/datareport/example_official.pdf.
- An internal version for your team, with R code. For an example, see www.julianfludwig.com/teaching/datareport/example_internal.pdf.
Both versions must be PDF files and are crafted using R Markdown. If you are new to R Markdown, refer to Chapter 6. Familiarizing yourself with this chapter before proceeding will make the following instructions more accessible.
Unlike a static report in Microsoft Word, where graphs are embedded as images, an R Markdown report is dynamic. Thus, running the R Markdown file updates the graphs within the resulting PDF, making it a living document that can change as the data changes. Hence, the R Markdown file, named something like data_report.Rmd
, will include both text and R code. When run, this will produce an output file like data_report.pdf
. The visibility of R code within the output file depends on the global settings in the R Markdown file. For instance, knitr::opts_chunk$set(echo=FALSE)
hides the R code chunks, while knitr::opts_chunk$set(echo=TRUE)
includes them. Additional settings like message=FALSE
and warning=FALSE
prevent R messages from displaying in the output file (see Chapter 6.4).
Standards for the Two PDFs
The two PDFs produced by your R Markdown file must adhere to the following standards:
- Both versions must be PDF files, directly generated from RStudio, not converted from another format like a Word file.
- The official version must conceal the dynamic nature of the report, meaning that R messages or code should not be visible. Consider the official version as what you’d present to clients - a polished data report without the technical details of the R code behind the visuals. Carefully consider the following for the official version:
- To suppress R messages (e.g., Loading required package: xts), use
message = FALSE
andwarning = FALSE
. See Chapter 6.4. - To hide R code (e.g.,
PV <- FV / (1 + YTM)^4
), useecho = FALSE
. More details are in Chapter 6.4. - Avoid hash tags in your document (e.g., \(\#\# \ 123.45\)), which appear when printing numbers or tables directly from an R chunk. Instead, weave numbers into the Markdown text, as described in Chapter 6.5, and use the
kable
function for tables, as explained in Chapter 6.7.
- To suppress R messages (e.g., Loading required package: xts), use
- Label every number, plot, and table accurately, and provide descriptive text.
- Ensure that all sentences are grammatically correct and complete, without missing verbs or unfinished thoughts.
Adhering to these guidelines will help guarantee that your report is professional, understandable, and aesthetically pleasing, resulting in a comprehensive presentation of the data.
Collaboration Guidelines
When writing the data report, working with study groups is allowed, but please follow these rules:
- Each student should independently select their own topic for the data report.
- Every student is responsible for writing their own R code and producing their individual reports.
- If you collaborate with other students on the report, acknowledge their contributions.
By adhering to these guidelines, you’ll have the chance to showcase your individual skills and understanding of the course content while still benefiting from the collaborative environment.
Example of a Data Report
I recommend downloading the following example for a data report on stock returns of Module A:
www.julianfludwig.com/teaching/datareport/example_report.Rmd
This R Markdown file produces the two PDF files referenced above for the official and internal versions. You can use this example report as a template and modify it to create your own report.
To use this file, download it, open it in RStudio, and then click Knit
: (or use the shortcut
Ctrl
+ Shift
+ K
or Cmd
+ Shift
+ K
). If it doesn’t produce a PDF file, you may need to install the necessary LaTeX software as described in Chapter 2.
The example report uses standard R programming syntax introduced in Chapter 3, xts
syntax introduced in Chapter 4.8, quantmod
syntax, and R Markdown syntax introduced in Chapter 6. Chapter 5.2 provides a good example of xts
and quantmod
syntax in action.
If some of the code doesn’t make sense, you can access help and documentation as described in Chapter 3.5.4. For example, you can retrieve information about a function using the ?
prefix in R (e.g., ?xts::apply.monthly
), read the vignettes of the used packages (e.g., vignette("xts")
), or use Google as a source of information.
Final Remarks
Given the requirement that the data report must be produced in R Markdown, it’s important to try running the example Rmd file ahead of time. This ensures that all necessary software is installed and functioning correctly. Without the proper setup, you won’t be able to complete the report, even if you have produced the content of the report. Preparing in advance will help you avoid technical issues and allow you to focus on demonstrating your data analysis skills.
Additionally, it’s crucial to adhere to the data report standards. A data report that includes programming code or contains incomplete sentences will not be acceptable to customers, regardless of the quality of the analysis.