knitr::opts_chunk$set(echo = FALSE)
knitr::knit_hooks$set(hook_convert_odg = rmdhelp::hook_convert_odg)

```{bash, echo=FALSE, eval=FALSE}

bash - export as jpeg

ls -1 /Users/${USER}/Google\ Drive/Vorlesungen/ASM/2022/OHP-L01/* | while read p do CURPICFN=$(basename "$p") echo " * Copy $p ..." cp "$p" ~/Desktop echo " * Convert ~/Desktop/$CURPICFN ..." mogrify -resize 50% -format jpg ~/Desktop/$CURPICFN echo " * Remove ~/Desktop/$CURPICFN ..." rm ~/Desktop/$CURPICFN sleep 2 done

```r
# include jpg into this rmd
this_rmd_file <- ifelse(rstudioapi::isAvailable(),
                        rstudioapi::getActiveDocumentContext()$path,
                        whereami::thisfile())


vec_pics <- list.files(path = "~/Desktop", pattern = ".jpg$")
for (pidx in seq_along(vec_pics)){
   cur_pic <- vec_pics[pidx]
   cur_pic_nr <- as.integer(unlist(strsplit(fs::path_ext_remove(cur_pic), "_"))[2])
  cat("\n## OHP Picture ", pidx, "\n\n", sep = "", file = this_rmd_file, append = TRUE)
  cat("```r\n", sep = "", file = this_rmd_file, append = TRUE)
  cat("rmdhelp::use_odg_graphic(ps_path = 'odg/ohp-page", cur_pic_nr, ".odg')\n", sep = "", file = this_rmd_file, append = TRUE)
  cat("fs::file_delete(path = '~/Desktop/", cur_pic, "')\n", sep = "", file = this_rmd_file, append = TRUE)
  cat("```\n\n", file = this_rmd_file, append = TRUE)
}
# add out.width parameter
this_rmd_file <- ifelse(rstudioapi::isAvailable(),
                        rstudioapi::getActiveDocumentContext()$path,
                        whereami::thisfile())
con_rmd <- file(description = this_rmd_file)
vec_rmd <- readLines(con = con_rmd)
close(con = con_rmd)
vec_rmd2 <- vec_rmd[60:length(vec_rmd)]
vec_rpl <- gsub(pattern = 'fig_path="odg", out.width="100%"}', replacement = 'fig_path="odg", out.width="70%"}', vec_rmd2)
cat(paste0(c(vec_rmd[1:59],vec_rpl), collapse = "\n"), "\n", file = this_rmd_file, append = FALSE)

OHP Picture 1

#rmdhelp::use_odg_graphic(ps_path = 'odg/ohp-page3460.odg')
knitr::include_graphics(path = "odg/ohp-page3460.png")
#fs::file_delete(path = '~/Desktop/IMG_3460.jpg')

OHP Picture 2

##rmdhelp::use_odg_graphic(ps_path = 'odg/ohp-page3461.odg')
knitr::include_graphics(path = "odg/ohp-page3461.png")
#fs::file_delete(path = '~/Desktop/IMG_3461.jpg')


charlotte-ngs/asmss2022 documentation built on June 7, 2022, 1:33 p.m.