This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# library(cubs) | |
library(Ryacas) | |
Ylm <- function(l,m,phi,theta){ | |
ex <- Ryacas::yac_expr(glue::glue("(-1)^{m}*(1-x^2)^({m}/2)*D(x,{m})OrthoP({l}, x)")) | |
sqrt((2*l+1)/(4*pi) * factorial(l-m) / factorial(l+m))* | |
exp(1i*abs(m)*phi) * eval(ex, list(x = cos(theta))) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "A graphics workflow" | |
author: "baptiste" | |
date: 2018-20-05 | |
--- | |
Glyphs are positioned by x and y coordinates; other parameters are kept separate as they may differ from glyph to glyph and, crucially, compound glyphs contain nested glyphs with their own properties, requiring a flexible container. | |
The structure of a glyph is thus as follows, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grab_math_strings <- function(fe){ | |
parse <- readLines(glue("{fe}-math.tex")) | |
content <- parse[parse != ''] | |
lines <- grep("math start", content) | |
start <- lines+1 | |
end <- c(lines[-1], length(content) + 1) - 1 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(minixml) | |
# devtools::install_github("coolbutuseless/minixml") | |
library(anytime) | |
generate_empty_feed <- function(file = 'index.xml'){ | |
doc <- xml_elem("rss", version="2.0") | |
channel <- doc$add('channel') | |
channel$add('title', "Photography") | |
channel$add('link', "https://photo.bapt.xyz/") | |
channel$add('description', "My latest photo pages") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r} | |
path <- fs::path("<<variable>>", ext = "csv") | |
cmd <- paste0("{{< downloadthis ", "'", path, "'", ' dname=<<variable>> label="Download the <<variable>> data" icon=database-fill-down type=info class=data-button id=<<variable>> >}}') | |
``` | |
```{r} | |
#| results: asis | |
cat(cmd) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "file 1" | |
format: html | |
--- | |
## Code Externalisation | |
Write R code in external R scripts, and use `read_chunk()` to read them into the current document. | |
```{r cache=FALSE} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# not needed | |
# library(ggplot2) | |
# disclaimer: this code is from 15 years ago... | |
# (kind of impressed it still runs!) | |
# example data | |
x <- seq(0, 10, len = 100) | |
y1 <- jitter(sin(x), 1000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(readr) | |
library(ggfittext) | |
d <- read_csv('PrevalenceAtLarge.csv') | |
d$value <- cut(d$PercentAtLarge, breaks = 5, | |
labels = c("doubling under 6 weeks", | |
"doubling in 2–6 weeks", | |
"stable", | |
"halving in 2–6 weeks", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE language SYSTEM "language.dtd"> | |
<language name="Julia" section="Scientific" | |
version="0" | |
extensions="*.jl" | |
mimetype="text/x-juliascript" | |
author="Andreas Nordal ([email protected])" | |
license="public domain"> | |
<highlighting> |