Skip to content

Instantly share code, notes, and snippets.

View KaiAragaki's full-sized avatar
🐈

Kai Aragaki KaiAragaki

🐈
View GitHub Profile
@KaiAragaki
KaiAragaki / gist:5d6db2eda1c75555d99f402b1b3aae8f
Created March 25, 2024 23:47
Tidy Data Identification Exercises
_____________________
TIDY DATA WORKSHEET
Kai
_____________________
2024-03-25 Mon
@KaiAragaki
KaiAragaki / my-workflow.txt
Last active June 8, 2023 13:05
My workflow
Almost all - if not all - of my new R projects are targets projects.
I'm usually bouncing between computers and occasionally have a collaborator, so targets makes it super super simple to spin up
my analyses at another computer.
Nowadays, I don't just use a targets project, but I like having multiple targets projects within one targets project. This
keeps the pipelines from getting to unweildly, at which point I usually get pretty overwhelmed.
(From here on, assume that when I say 'project' I mean a targets project, not an RStudio project - all of this happens in a
single RStudio project)
@KaiAragaki
KaiAragaki / get_n_rosalind_usrs.R
Created July 20, 2022 19:01
Get number of Rosalind Users
library(rvest)
library(stringr)
read_html("https://rosalind.info/statistics/countries/") |>
html_elements(".span3") |>
html_text(trim = T) |>
stringr::str_extract("[:digit:]*$") |>
as.numeric() |>
sum()
@KaiAragaki
KaiAragaki / gist:bb204efc5d00fcae9c84ffbcabaaa08f
Last active February 2, 2022 16:27
Flip numbers on a finite interval with known bounds
# 'Flip' numbers on a number interval
# my_nums: 1 2 5 10
# 1
# interval: 1 ---- 2 ---- 3 ---- 4 ---- 5 ---- 6 ---- 7 ---- 8 ---- 9 ---- 10
# Flipped:
# newnums: 1 6 9 10
# 10
@KaiAragaki
KaiAragaki / gist:76d65bd4250f946b60cd080de3bd4c09
Created January 5, 2022 14:49
Self-assign + pipe snippet
snippet slfp
${1:name} <- ${1:name} |>
@KaiAragaki
KaiAragaki / get_tufte.R
Created June 1, 2021 13:49
Tufte-ify your plots with ease!
library(ggplot2)
library(showtext)
showtext_auto()
if(Sys.info()[["sysname"]] == "Windows") {
font_add("GillSans", "GIL_____.TTF")
} else if(Sys.info()[["sysname"]] == "Darwin") {
font_add("GillSans", "GillSans.ttc")
}