- Original article: https://qiita.com/frogcat/items/3d795c5cbe026c372bf4 (Japanese)
- Original idea: https://dailyportalz.jp/kiji/douro-hougaku-machi-no-dekikata (Japanese)
- How to calculate tile location from lat-long: https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Pseudo-code
- A function to read vector tiles: https://jeroen.cran.dev/protolite/reference/mapbox.html
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) { |
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(rayrender) | |
# generate path data by https://github.com/yutannihilation/rusttype-test | |
d <- readr::read_csv("/tmp/tmp.csv", col_names = c("x", "y", "id")) | |
l <- split(d, d$id) | |
colors <- scales::colour_ramp(c("#FF3499", "#FFECEC"))(seq(from = 0.4, to = 0.0, length.out = length(l))) | |
dir.create("/tmp/tokyor/") |
tidyr::separate()
cannot handle the cell that contains arbitrary order of values.
separate_rows()
+ pivot_wider()
works to some extent, but this cannot handle an empty string or a missing value.
tibble(
id = 1:4,
answer = c("a,b", "a,c", "a,b,c", "c")
) %>%
# separate() だとできないのでいったん縦向きに広げてから pivot する
separate_rows(answer) %>%
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
==> devtools::test() | |
Loading ggplot2 | |
Testing ggplot2 | |
✓ | OK F W S | Context | |
✓ | 1 | Adding plot elements | |
✓ | 17 | test-aes-calculated.r | |
✓ | 11 | Aesthetics (grouping) [0.4 s] | |
✓ | 10 | Aes - setting values [0.6 s] | |
✓ | 45 | Creating aesthetic mappings [1.3 s] |
library(dplyr, warn.conflicts = FALSE)
g <- starwars %>%
select(name, mass, species) %>%
group_by(species)
# usual usage of mutate()
d1 <- g %>%
mutate(mass_norm = mass / mean(mass, na.rm = TRUE))