#' Write setup chunk
#'
#' Write setup chunk.
#'
#' @param path Local path of working directory
#' @param link2wd Boolean; should links be to working directory on Joslin network? Otherwise, links are to local folder
#' @export
setup_chunk <- function(path, link2wd = TRUE){
wd.path <- ifelse(link2wd, paste0("J:/cores/bioinformatics/", path), ".")
r_code <- c('setwd("B:/")', 'source("fcns/config.r")', paste0('wd <- "', wd.path, '"'), "setwd(sub('J:/cores/bioinformatics', 'B:', wd, fixed = TRUE))")
chunk <- c("```{r setup, include=FALSE}", "knitr::opts_chunk$set(echo = FALSE, include = FALSE)",
r_code, "```")
return(chunk)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.