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
To implement a Rust function for R with extendr, users can choose to use either (or both) of the following:
- Rust types (e.g.
i32
, and&str
) - Proxy types (e.g.
Integer
, andCharacter
)
For Rust types, we need to consider how to handle the case where the types are incompatible between R and Rust.
c.f. https://github.com/coolbutuseless/fugly#simple-benchmark
library(ore)
library(unglue)
library(ggplot2)
# meaningless strings for benchmarking
string <- paste0("Information name:greg age:", 1:1000)
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),
This file contains 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
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> |
This file contains 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
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() |
This file contains 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
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 | |
| |
This file contains 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
#| fig.width: 12 | |
#| fig.height: 8 | |
#| dpi: 100 | |
#| dev: ragg_png | |
library(readr) | |
library(dplyr, warn.conflicts = FALSE) | |
library(ggplot2) | |
f <- \(...) scale_colour_viridis_d(option = "F", end = 0.94, direction = -1, ..., aesthetics = c("colour", "fill")) |
This file contains 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(string2path) | |
d <- string2path("ABCDE", "/usr/share/fonts/TTF/iosevka-extrabold.ttf") | |
colnames(d) <- c("x", "y", "group") | |
d$subgroup <- 1 | |
library(triangular) | |
library(ggplot2) | |
m <- as.matrix(d[,1:2]) |
This file contains 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(string2path) | |
d <- string2path("ABCDE", "/usr/share/fonts/TTF/iosevka-extrabold.ttf") | |
colnames(d) <- c("x", "y", "group") | |
d$subgroup <- 1 | |
library(triangular) | |
library(ggplot2) | |
plot_frame <- function(i) { |