Skip to content

Instantly share code, notes, and snippets.

View rosalieb's full-sized avatar

Rosalie Bruel rosalieb

View GitHub Profile
@rosalieb
rosalieb / squircle.R
Created January 16, 2023 17:58 — forked from alistaire47/squircle.R
squircles
library(tidyverse)
library(gganimate)
animate(
crossing(
p = seq(0.1, 5, by = 0.1),
theta = seq(0, 2*pi, length.out = 101)
) %>%
mutate(r = 1 / (abs(cos(theta))^p + abs(sin(theta))^p)^(1/p)) %>%
ggplot(aes(theta, r, fill = p)) +
@rosalieb
rosalieb / render_toc.R
Last active April 1, 2019 21:46 — forked from gadenbuie/render_toc.R
Generate Manual Table of Contents in (R)Markdown Documents
#' Render Table of Contents
#'
#' A simple function to extract headers from an RMarkdown or Markdown document
#' and build a table of contents. Returns a markdown list with links to the
#' headers using
#' [pandoc header identifiers](http://pandoc.org/MANUAL.html#header-identifiers).
#'
#' WARNING: This function only works with hash-tag headers.
#'
#' Because this function returns only the markdown list, the header for the