Skip to content

Commit 0b700cd

Browse files
committed
show summary of csv file in manifest with skimr
also allow jpeg as extension for image file
1 parent 9ce552c commit 0b700cd

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ Remotes: eblondel/zen4R
3232
VignetteBuilder: knitr
3333
Suggests:
3434
tinytest,
35-
ttdo
35+
ttdo,
36+
skimr

inst/extdata/templates/codecheck/codecheck.Rmd

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ output:
44
toc: false
55
includes:
66
in_header: codecheck-preamble.sty
7+
latex_engine: xelatex
78
---
89

910
```{r rsetup,eval=TRUE,include=FALSE}
@@ -51,7 +52,6 @@ latex_summary_of_metadata(metadata)
5152
latex_summary_of_manifest(metadata, manifest_df, root)
5253
```
5354

54-
5555
# Summary
5656

5757
This code was (not) straightforward to codecheck.
@@ -70,10 +70,12 @@ This took ... minutes to complete on {a large workstation, my laptop}.
7070

7171
\clearpage
7272

73-
```{r, echo=FALSE, results="asis"}
73+
# Manifest files
74+
75+
```{r, echo=FALSE, results="asis", width=100}
7476
for(i in c(1:nrow(manifest_df))) {
7577
path <- manifest_df[i,"dest"]
76-
if(stringr::str_ends(path, "(png|pdf|jpg)")) {
78+
if(stringr::str_ends(path, "(png|pdf|jpg|jpeg)")) {
7779
# include graphics with knitr has to happen at top level in chunks, see https://github.com/yihui/knitr/issues/1260
7880
# see also https://stackoverflow.com/questions/51268623/insert-images-using-knitrinclude-graphics-in-a-for-loop
7981
# knitr::include_graphics(manifest_df[1, "dest"], error = TRUE)
@@ -82,12 +84,17 @@ for(i in c(1:nrow(manifest_df))) {
8284
cat("**Comment:** ", manifest_df[i,"comment"], "\n\n")
8385
cat(paste0("![", "Test ", "](", path, ")\n"))
8486
} else if (stringr::str_ends(path, "(Rout|txt)")) {
85-
cat("**File: ", basename(path), "**\n\n")
87+
cat("## ", basename(path), "\n\n")
8688
cat("\\scriptsize \n\n", "```txt\n")
8789
cat(readLines(path), sep = "\n")
8890
cat("\n\n``` \n\n", "\\normalsize \n\n")
91+
} else if (stringr::str_ends(path, "csv")) {
92+
cat("## ", basename(path), "\n\n", "Summary statistics of tabular data:", "\n\n")
93+
cat("\\scriptsize \n\n", "```txt\n")
94+
print(skimr::skim(read.csv(path)))
95+
cat("\n\n``` \n\n", "\\normalsize \n\n")
8996
} else {
90-
cat("**File: ", basename(path), "**\n\n")
97+
cat("## ", basename(path), "\n\n")
9198
cat("Cannot inlcude output file as figure.")
9299
}
93100

0 commit comments

Comments
 (0)