R
1 + 1
📜The narrative around the code is as important as the code itself📜
The code you use to produce analytical outcomes and summaries is the lifeblood of your work as a data science practitioner.
Literate programming platforms provide unique tools for code access that are enabled at the document/presentation-level, if desired. For example, you may have collaborators who wish to inspect code or you may be documenting your code to provide full transparency for the process(es) used to conduct an analysis.
The code represented in Listing 1.1 (and all example pieces of code) can be copied by activating the clipboard option in the upper-right hand corner of the code chunk.
Code can always be copied onto your personal computer via the clipboard icon: .
For more complex bits of analysis, hidden annotations are available (the reader can further access notes/assistance by hovering over the circled numbers):
library(psych)
data(bfi)
bfi$jibberish <- rowMeans(bfi[1:10], na.rm=TRUE)
bfi$gobbleyjook <- rowMeans(bfi[11:20], na.rm=TRUE)
psych
package contains example data that we can access.
bfi
dataset that contains personality item responses.
jibberish
and gobbleyjook
. The $
notation indicates that these scale scores will be appended to the bfi
dataframe.
The entire code block can also be hidden unless asked-for. These features permit reviewers/collaborators of different need or curiosity to access source code on an as-needed basis:
psych
package contains example data that we can access.
bfi
dataset that contains personality item responses.
jibberish
and gobbleyjook
. The $
notation indicates that these scale scores will be appended to the bfi
dataframe.
Summaries of your analyses are typically the most important (to external review) aspect of your work. These are the illustrations of your story. The primary principles of analyses within a literate programming framework are:
Below you can find a few data presentation enhancements that are enabled via literate programming platforms.
Figure 1.1 demonstrates lightbox
capabilities for images embedded within literate programming reports, whereby “clicking” isolates the image for closer inspection. This is useful for images that contain fine detail, user devices that may not display optimally, drawing focus to specific data features, and increasing accessibility for visually impaired viewers.
Figure 1.2 highlights standard interactive components for graphical representations of data. These interactive components are fully accessible within the source document/presentation.
Figure 1.3 is another example of interactivity - a map such as this can help reinforce viewer concepts such as representativeness within normative samples (e.g., where the data “came from” and who the data represents). The audience can get a sense of geographic representation by “zooming out” or “zooming in” and verifying that only North America is represented within this dataset.
Video 1.1 shows another example - videos can be pulled from external sites (like this tutorial on parameterized reporting within Quarto) or can present locally produced video files.