/
logrx.Rmd
84 lines (65 loc) · 3.64 KB
/
logrx.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
title: "logrxpackage"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{logrxpackage}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r setup, echo = FALSE}
library(logrx)
```
# Generating a log
The purpose of the `logrx` package is to generate a log upon execution of an R script which enables traceability and reproducibility of the executed code. Generating a log with `{logrx}` can be as simple as running one line of code as seen in the below example of how to use the `axecute()` function.. However, `{logrx}` has much more advanced capabilities to meet the demands of Clinical Reporting. To learn additional techniques about executing code with ```{logrx}``` please visit our [Execution Vignette](https://pharmaverse.github.io/logrx/articles/execution.html).
## `axecute()`
`axecute()` enables the command line submission of a program. A log is set-up around the program, and its code is run safely and loudly (using `safely()` from the `purrr` package). The log will be generated in the same folder as the script unless you specify differently.
```{r axecute, eval = FALSE}
axecute("my_script.R")
```
## `logrx` addin:
A log can be generated using the ```{logrx}``` addin, which is a simple point and click interface that allows you to run a single program. The Addin ships with the package and is available once you use install the package. The gif on the [Get Started](https://pharmaverse.github.io/logrx/index.html) page gives a quick snapshot of its intended use.
# Log attributes
We have compiled a brief overview of the information that we capture in the log file generated by `{logrx}`. We allow users to customize sections of the log based on their needs for a log, e.g. you can toggle on/off the messages, outputs, errors and messages. You can also build into your log approved and unapproved packages used in your R script - see [Logging Unapproved Package and Function Use]( https://pharmaverse.github.io/logrx/articles/approved.html) for additional guidance
The following attributes are recorded in the log:
* **Metadata**: `{logrx}` package information
+ Version of the package
+ Type of build
+ Link to the GitHub repository
* **User and File Information**
+ User that generated the log
+ Name and path of the script for which the log was generated
+ `hash_sum`: A unique hashsum is created for the log file
* **Session Information**: The R session information
+ R version
+ OS and system
+ GUI
+ Language and timezone
+ Packages - List of all available packages in the environment
+ External Software - List of all external software
* **Masked Functions** - List of all functions masked by packages
* **Program Run Time Information** - Start, end, and run times
* **Used Package and Functions (optional)** - List of all packages and functions used in the
script for which the log was generated
* **Unapproved Package and Functions (optional)** - List of all packages and functions used in
the script for which the log was generated that are not part of the approved
list of packages and functions
* **Errors and Warnings** - List of Errors and Warnings from the Script
* **Messages, Output and Results (optional)** - List Messages, Outputs and Results
* **Log Output File** - Name and path of the log
Below we have a scrollable example of what is included in a log file for an `adsl.R` script.
<style>
.scrolled {
overflow-y: scroll !important;
white-space: nowrap;
max-height: 400px;
}
</style>
<div class = "scrolled">
<img src='`r here::here("man/figures/log.png")`'/>
</div>