diff --git a/U_BDS_general_template.Rmd b/U_BDS_general_template.Rmd index ef670b9ffe374f23640e9cd1896aab18a47b849b..e5eb84315453d0d84cabe80189b7256550fda992 100644 --- a/U_BDS_general_template.Rmd +++ b/U_BDS_general_template.Rmd @@ -14,6 +14,35 @@ output: ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) + +knitr::knit_hooks$set(time_it = local({ + now <- NULL + function(before, options) { + if (before) { + # record the current time before each chunk + now <<- Sys.time() + } else { + # calculate the time difference after a chunk + res <- difftime(Sys.time(), now) + # return a character string to show the time + paste("Time for this code chunk to run:", res) + } + } +})) +knitr::opts_chunk$set(time_it = TRUE) + + +Fig_dir = "./results/" +dir.create(Fig_dir, showWarnings = FALSE) + +knitr::opts_chunk$set(fig.width=10, fig.height=10, fig.path=Fig_dir, + echo=TRUE, warning=FALSE, message=FALSE, dpi = 300, fig.retina = 2) +``` + +```{r klippy, echo=FALSE, include=TRUE} +# install.packages("remotes") +# remotes::install_github("rlesur/klippy") +klippy::klippy() ``` # Overview