Skip to content

Instantly share code, notes, and snippets.

View dmenne's full-sized avatar

Dieter Menne dmenne

View GitHub Profile
@dmenne
dmenne / bookdowncrossreference_word.Rmd
Last active December 14, 2022 09:03
Markdown to Word: Cross-references and captions for tables and figures
---
title: "Markdown to Word: Cross-references and captions for tables and figures"
output:
bookdown::word_document2
---
```{css, echo=FALSE}
blockquote {
font-size: 16px;
}
@dmenne
dmenne / bookdowncrossreference.Rmd
Last active February 14, 2023 20:16
Markdown to HTML: Cross-references and captions for tables and figure
---
title: "Markdown to HTML: Cross-references and captions for tables and figure"
output:
bookdown::html_document2
---
Update December 2022: `gt` and `rtables` (partially) have cross-references.
And there is [`quarto`](https://quarto.org/docs/authoring/cross-references.html), not treated here, which has a much more elegant referencing syntax.
@dmenne
dmenne / brmsgrouped,R
Last active January 23, 2020 17:15
Grouped nonlinear fit to breathtest data with brms
# See https://discourse.mc-stan.org/t/how-to-translate-a-stan-nonlinear-fit-to-brms/12764/2
suppressPackageStartupMessages(library(brms))
library(breathtestcore)
library(dplyr)
library(ggplot2)
set.seed(4711)
data("usz_13c_d", package = "breathtestcore")
data = usz_13c_d
data = usz_13c_d[usz_13c_d$patient_id < "sub_18",]
# runstan.R
session_dir = commandArgs(TRUE)[1]
chains = commandArgs(TRUE)[2]
# For debug
if (is.na(session_dir)) session_dir = tempdir()
if (is.na(chains)) chains = 2
log_file = file.path(session_dir, "stan.log")
dummy = suppressWarnings(unlink(log_file))
out_file = paste0(session_dir, "stan.rda")