Skip to content

Instantly share code, notes, and snippets.

View yutannihilation's full-sized avatar
🍣
Nobody loves you

Hiroaki Yutani yutannihilation

🍣
Nobody loves you
View GitHub Profile
library(ggplot2)
library(patchwork)
library(dplyr, warn.conflicts = FALSE)
d <- string2path::string2path("R", "Arial")
max_dist <- 0.003
d2 <- d |>
group_by(glyph_id, path_id) |>
library(ggplot2)
f <- systemfonts::system_fonts() |>
dplyr::filter(family == "Iosevka", style == "Heavy") |>
dplyr::pull(path)
d_pkg <- string2path::string2fill("arrow", f[1], tolerance = 0.01) |>
dplyr::mutate(
fill = as.integer(triangle_id + 50 * runif(dplyr::n()))
library(ggplot2)
library(string2path)
library(dplyr, warn.conflicts = FALSE)
library(gganimate)
f <- systemfonts::system_fonts()
# This is reproducible but only on my laptop, sorry for my laziness...
set.seed(100)
some_fonts <- sample(f$path[tools::file_ext(f$path) %in% c("ttf", "otf")], 30)
library(string2path)
library(ggplot2)
d <- string2path("?", "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-BoldItalic.ttf")
f <- function(d, theta) {
d <- dplyr::mutate(d, x = x + 0.02 * cos(theta * 3.2), y = y + 0.02 * sin(theta * 2.1))
d2 <- dplyr::bind_rows(
@yutannihilation
yutannihilation / current.md
Last active September 20, 2021 00:48
Check the behaviours around manual scales (current.md: the current dev version, pr4619.md: https://github.com/tidyverse/ggplot2/pull/4619)
library(tidyverse)
library(patchwork)

excel_file <- tempfile(fileext = ".xlsx")
curl::curl_download("https://www.fukushihoken.metro.tokyo.lg.jp/iryo/kansen/kensa/kensuu.files/syousaisenryakukensa.xlsx", excel_file)

d_raw <- readxl::read_excel(excel_file, skip = 2)
d_raw
#> # A tibble: 18 × 4

(Draft) extendr's conversion specs and semantics

Scope of this document

To implement a Rust function for R with extendr, users can choose to use either (or both) of the following:

  1. Rust types (e.g. i32, and &str)
  2. Proxy types (e.g. Integer, and Character)

For Rust types, we need to consider how to handle the case where the types are incompatible between R and Rust.

library(stringr)
library(ggplot2)
library(rr4r)

ptn <- r"([\w]+://[^/\s?#]+[^\s?#]+(?:\?[^\s#]*)?(?:#[^\s]*)?)"
url <- "https://mail.google.com/mail/u/0/"

res1 <- bench::press(
 x = c(1, 1e3, 1e5),
PS C:\Users\...\Documents\tmp> C:\rtools40\mingw64\bin\g++ -std=gnu++11 -O3 .\main.cpp
PS C:\Users\...\Documents\tmp> .\a.exe
PS C:\Users\...\Documents\tmp>