Skip to content

Instantly share code, notes, and snippets.

@knbknb
Last active August 3, 2025 16:39
Show Gist options
  • Select an option

  • Save knbknb/d356f50552d800bb6ce2ba19ce7c4db1 to your computer and use it in GitHub Desktop.

Select an option

Save knbknb/d356f50552d800bb6ce2ba19ce7c4db1 to your computer and use it in GitHub Desktop.
Rmd: Personal Front Matter & Chunks
---
title: "-"
author: "Knut Behrends, `r lubridate::year(lubridate::now())`"
summary: ""
date: '`r paste0("2022 / updated ", Sys.Date())`'
output:
html_document:
# CSS file must exist for knit() to succeed
# styles.css: img { width:150%; }
# css: styles.css
theme: cerulean
toc: true
toc_float: false
toc_depth: 4
code_folding: hide
params:
data: "somevalue"
infile: "myinfile.csv"
printcode: "TRUE"
# see also "Knit with parameters" GUI option in Rstudio
---
# H1
## Setup
### Document Rendering
(Detailed document rendering options not shown)
```{r setup, include=FALSE}
library(knitr)
opts_knit$set(sql.max.print = NA) # specify max.print in chunks
opts_chunk$set(cache = FALSE, warning = FALSE, message = FALSE, eval = TRUE,
tidy = FALSE, #height = 3, width = 5,
fig.width = 9)
knitr::opts_chunk$set(echo = params$printcode)
# options(knitr.table.format = "html")
# knitr::opts_chunk$set(root.dir = "_my/R_one-offs/someproject")
```
### R Packages
```{r pkgs, cache=FALSE, echo=TRUE, message=FALSE, warning=FALSE}
library(here) # for filesystem access
library(scales) # for plotting
library(glue) # formatting strings
library(htmltools) # DOM
library(lubridate) # parsing datetime information
library(kableExtra) # table formatting
library(RCurl) # or curl, httr, or rvest?
library(tidyverse) # powerful data processing
theme_set(theme_bw())# white background
```
```{r paths}
# absolute paths...
if(Sys.info()[["nodename"]] == "wb45"){
setwd("~/code/git/_my/R-parallel")
} else {
setwd("~/code/git/_my/R_stuff/r-parallel")
}
```
```{r kableExtra}
# knitr::kable(row.names = TRUE) %>%
# kableExtra::kable_styling(bootstrap_options = "striped")
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment