Skip to content

Instantly share code, notes, and snippets.

Avatar
🍣
Nobody loves you

Hiroaki Yutani yutannihilation

🍣
Nobody loves you
View GitHub Profile
View string2path_0.0.3_animation.R
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)
View question_mark.R
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 Sep 20, 2021
Check the behaviours around manual scales (current.md: the current dev version, pr4619.md: https://github.com/tidyverse/ggplot2/pull/4619)
View current.md
View tmp.md
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
View 00_spec.md

(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.

View performance_of_rr4r.md
View performance_of_rr4r.md
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),
View console.txt
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>
View minimal_rcpp_code_to_freeeze_windows.R
Rcpp::cppFunction('
void foo() {
// works fine if I change the pattern to one without []
std::regex reg("[0-9]");
}
', includes = "#include <regex>")
# works
Sys.setlocale("LC_ALL", 'English')
foo()
View cargo_clippy_extendr_result_20210109.txt
warning: matching on `Some` with `ok()` is redundant
--> extendr-macros/src/output_r.rs:20:5
|
20 | if let Some(manifest_dir) = env::current_dir().ok() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(clippy::if_let_some_result)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_let_some_result
help: consider matching on `Ok(manifest_dir)` and removing the call to `ok` instead
|