Skip to content

Instantly share code, notes, and snippets.

@remlapmot
Last active August 24, 2022 09:37
Show Gist options
  • Save remlapmot/8a78260c17a24554053c6fab6603f6a1 to your computer and use it in GitHub Desktop.
Save remlapmot/8a78260c17a24554053c6fab6603f6a1 to your computer and use it in GitHub Desktop.
Markdown (and in effect R Markdown) code snippets file for RStudio; file location on Windows: %appdata%\RStudio\snippets; on Mac/Linux: ~/.config/rstudio/snippets
snippet [
[${1:label}](${2:location})
snippet ![
![${1:label}](${2:location})
snippet r
```{r}
${0}
```
snippet rcpp
```{r, engine='Rcpp'}
#include <Rcpp.h>
using namespace Rcpp;
${0}
```
snippet rmdhd
---
title: "${1:Title}"
author: "Tom Palmer"
date: "`r "\u0060r format(Sys.time(), '%d %B %Y')\u0060"`"
output:
html_document:
toc: true
toc_float:
collapsed: false
smooth_scroll: false
toc_depth: 2
code_download: true
code_folding: show
---
# Equation
snippet eq
\begin{equation}
${1}
\end{equation}
# Equation
snippet eq*
\begin{equation*}
${1}
\end{equation*}
# Equation
snippet eqa
\begin{equation}
\begin{aligned}
${1}
\end{aligned}
\end{equation}
# Equation
snippet $$
\$\$
${1}
\$\$
# Equation
snippet $$a
\$\$
\begin{aligned}
${1}
\end{aligned}
\$\$
snippet st
```{stata}
${0}
```
snippet ki
```{r, echo=FALSE, out.width="50%"}
knitr::include_graphics("${1:filename}")
```
snippet fr
## ${1:title}{.allowframebreaks .t}
snippet p
```{python}
${0}
```
snippet as
```{asis}
${0}
```
# From Tom Mock Quarto snippets https://gist.github.com/jthomasmock/11acebd4448f171f786e01397df34116
snippet fragment
[${1:text}]{.${2:type}}
snippet aside
[${1:text}]{.aside}
snippet fence
:::{.${1:type}}
${2:body}
:::
snippet panel
::: {.panel-tabset}
${1:body}
:::
snippet column
:::: {.columns}
::: {.column width="40%"}
Left column
:::
::: {.column width="60%"}
Right column
:::
::::
@remlapmot
Copy link
Author

The additions to the RStudio markdown.snippets file are after the rcpp snippet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment