-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathappendix.Rmd
executable file
·56 lines (36 loc) · 1.42 KB
/
appendix.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
# Appendix
```{r, echo = FALSE, message = FALSE, warning = FALSE}
# quiet <- capture.output({
# renv::activate(project = here::here())
# #source(here::here("_common.R"))
# })
library(here)
library(digest)
# hash algorithm picked based on https://csrc.nist.gov/projects/hash-functions
hash_algorithm <- "sha256"
# get hash of commit at HEAD
commit_hash <- system("git rev-parse HEAD", intern = TRUE)
# get hash of input processed data file based on chosen hashing algorithm
processed_file_digest <- digest(file = path_to_data, algo = hash_algorithm)
# this function did not really work, but somehow the output is wrapped
insert_zero_width_space <- function(input_string, n) {
# Split the string into chunks of n characters
string_split <- strsplit(input_string, "")[[1]]
# Insert space every n characters
result <- sapply(seq_along(string_split), function(i) {
if (i %% n == 0 && i != length(string_split)) {
return(paste0(string_split[i], " "))
} else {
return(string_split[i])
}
})
# Combine the result back into a single string
result_string <- paste0(result, collapse = "")
return(result_string)
}
```
This report was built with code from:
`r sub("\\.git", paste0("/commits/", commit_hash), system("git remote get-url origin", intern = TRUE) )`
and data from:
`r insert_zero_width_space(config$data_cleaned, 60)`
with `r hash_algorithm` hash sum: `r processed_file_digest`