Reporting tools

The esmtools package has some tools to help to create a preprocessing report and data quality reports. In particular, we have developed two tools: highlight text, and toggle button. Also part of those tools, you can have a look at the Session and Dataset info section. All tools are implemented in the advanced version of the preprocessing report (see the report example folder).

Highlighting text

In the report, we particularly encourage highlighting any data modifications and identified issues. Users can emphasize specific sections, making it easier to spot and communicate changes made during the preprocessing phase. Often, you only need to copy and paste the required code (see the instruction in the template) and adapt the description part. We propose two methods:

  • ‘txt()’ function from the esmtools package. It can be used in two different ways.
    • Basic: make reporting simple.
    • Exporting: enable exporting of the comments.
  • HTML tags and CSS code: it does not requiere function.

txt(): basic

The txt() function generates custom text and provides the option to include an optional count that can be integrated into the text. Whenever you have spotted an issue in your dataset (e.g., duplication), you can use the inline code below (within ``). The arguments of the function are the following:

  • id: a character string that makes the link with the css style. Predefined styles are: ‘esm-issue’, ‘esm-mod’, ‘esm-inspect’. You can create your own CSS style and associate it.
  • title: the part that is highlighted.
  • count: a logical value (TRUE by default) indicating whether to include a count in the title part.

For instance, the following inline code `r txt(id='esm-issue',title='Issue',count=TRUE)` The issue is that ... gives:

Issue 1: The issue is that …

Note for consiseness, you can remove the argument names (e.g., ‘txt(’esm-issue’,‘Issue’,TRUE)’).

Note

You can as well highligth:

  • Data modifications: using `r txt(id='esm-mod','Modification',TRUE)` I changed ...

Modification 1: I changed …

  • Data inspection: using `r txt(id='esm-inspect','Inspection')` Here we can see that ...

Inspection: Here we can see that …

Note

The ‘esm-issue’, ‘esm-mod’, and ‘esm-inspect’ css class styles are imported whenever you import the esmtools package. You can override those styles to modify the fonts, colors, etc., as you like (an example is commented). In certain cases, you might need to use the ‘!important’ declaration to override the default style definitions.


<style>
.esm-issue{
  /* font-family: Georgia; */
}
</style>

Toggle button

The ‘button()’ and ‘endbutton()’ functions from the esmtools package delimite part of the document that can be revealed using a button. It is particularly useful to hide non-essential elements (but still important to report) to improve readibility. A name can be given to the button using the ‘text’ argument.

Warning

Prior to employing the button() function, it’s essential to load the esmtools package. Consequently, the inclusion of the esmtools package can be performed within the scope of the ‘button()’ and ‘endbutton()’ functions. It’s crucial to ensure this import is the initial action.

To make it work, enclose the part between the ‘button()’ and ‘endbutton()’, following this example:

  `r button(text = 'Description')` 

```{r}
print(1 + 1)
```

```{r}
print(2 + 2)
```

`r endbutton()`

The above example results in the following button. Click to toggle the content.

print(1 + 1)
[1] 2
print(2 + 2)
[1] 4

Note

We propose to use two button names that are particularly relevant:

  • ‘Descriptive’: add any descriptive analysis that helps to have a broad view of the data, such as summary tables.
  • ‘Supplementary’ button: add every other functions you used to inspect the data but that were not relevant to highlight the spotted issues.