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
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
|
sudo pacman -S libutf8proc
cd cpp
mkdir build
cd build
ARROW_BUILD_TOOLCHAIN=/usr ORC_HOME=/usr DOUBLE_CONVERSION_HOME=/usr cmake \
.. -DARROW_DEPENDENCY_SOURCE=SYSTEM \
-DARROW_PYTHON=ON \
-DCMAKE_BUILD_TYPE=Release \
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) {
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])
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/")
@yutannihilation
yutannihilation / separate_cols.md
Last active July 24, 2020 21:07
separate_cols()

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) %>% 
@yutannihilation
yutannihilation / dev_version_testthat_result.txt
Created July 5, 2020 14:06
Test result of ggplot2 with the dev version of testthat
==> 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]
@yutannihilation
yutannihilation / Are_mutate_and_summarise_different.md
Created June 27, 2020 23:22
Are mutate() and summarise() different?
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))
library(estatapi)
#> このサービスは、政府統計総合窓口(e-Stat)のAPI機能を使用していますが、サービスの内容は国によって保証されたものではありません。
library(dplyr, warn.conflicts = FALSE)
library(ggplot2)

d <- estat_getStatsData(appId = keyring::key_get("estatapi"), statsDataId = "0003368797")
#> Fetching record 1-2120... (total: 2120 records)

d %&gt;%