Skip to content

Instantly share code, notes, and snippets.

Emi Tanaka emitanaka

Block or report user

Report or block emitanaka

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@emitanaka
emitanaka / animate-voting.R
Last active Apr 30, 2020
Instant-runoff voting system for the 🇦🇺 House of Representative election in 2019
View animate-voting.R
# the party logos are required to be in the form of `plogo-XXX.png` where XXX is the party abbreviation that matches
# in PartyAb
# inspired by https://coolbutuseless.github.io/2020/04/12/racing-barplots-with-ggpattern-flagon-gganimate/
library(tidyverse)
library(gganimate)
library(ggpattern)
dat <- read_csv("https://results.aec.gov.au/24310/Website/Downloads/HouseDopByDivisionDownload-24310.csv", skip = 1) %>%
mutate(PartyAb = case_when(
@emitanaka
emitanaka / example.html
Created Sep 11, 2019
remark.js bug - unclosed square bracket
View example.html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<style>
.column1, .column2 {
position: absolute;
top:0;
width:50%;
}
@emitanaka
emitanaka / buggy_slide_with_fix.Rmd
Created Sep 11, 2019
xaringan ninjutsu remark.js bug
View buggy_slide_with_fix.Rmd
---
output:
xaringan::moon_reader:
css: "ninjutsu"
seal: false
---
class: split-40
count: false
@emitanaka
emitanaka / collapseoutput.js
Created Jul 20, 2019
Collapsible Code Output for `xaringan`
View collapseoutput.js
<script>
(function() {
var divHTML = document.querySelectorAll(".details-open");
divHTML.forEach(function (el) {
var preNodes = el.getElementsByTagName("pre");
var outputNode = preNodes[1];
outputNode.outerHTML = "<details open class='output'><summary>Output</summary>" + outputNode.outerHTML + "</details>";
})
})();
(function() {
View keybase.md

Keybase proof

I hereby claim:

  • I am emitanaka on github.
  • I am emitanaka (https://keybase.io/emitanaka) on keybase.
  • I have a public key ASBn0EYjrw-NsypB8fDZvX1xNNWZPPkVzwt2bupVc7zt6Ao

To claim this, I am signing this object:

@emitanaka
emitanaka / hadleyinsydney.R
Last active May 1, 2019
Hadley in Sydney Public Lecture
View hadleyinsydney.R
# the power of piping + functional programming + stringr + some gluing <3
library(tidyverse)
tidyverse <- "Hadley"
"You're" -> Hadley
"super" -> Thanks
"{tidyverse} is awesome" %>%
str_glue() %>%
View IBSlogo_animation.R
library(gganimate)
library(tidyverse)
IBSlogo <- tribble(
~Row, ~Col, ~Fill, ~Text,
3, 1, "white", "I",
3, 2, "#7fb8ff", "",
3, 3, "#0170fe", "",
2, 1, "#0170fe", "",
2, 2, "white", "B",
@emitanaka
emitanaka / graph.R
Created Jan 30, 2019
child geom point plot for CY
View graph.R
library(tidyverse)
library(ggrepel)
dat <- tibble::tribble(
~Visits, ~FEV, ~No, ~Group, ~Line, ~Child,
"0", 78, NA, "Smokers", 1, NA,
"1", 76, 2682, "Smokers", 1, 1,
"2", 74, 2335, "Smokers", 1, 2,
"3", 73, 2959, "Smokers", 1, NA,
"2", 79, 208, "Outliers", "O1", 1,
"3", 78, 152, "Outliers", "O2", 2,
@emitanaka
emitanaka / custom.css
Created Jan 4, 2019
For fixing printing from chrome for xaringan
View custom.css
/*
Below is for 16:9. Adjust to suit your own.
*/
@page {
size: 1210px 681px;
margin: 0;
}
@media print {
.remark-slide-scaler {
@emitanaka
emitanaka / harvest.R
Created Nov 22, 2018
Tractor harvesting
View harvest.R
library(tidyverse)
library(gganimate)
library(ggimage)
# make data set for movement of the tractor
harvest_df <- data.frame(
x=c(-0.375 + 0.75*(0:15), rep(-0.375 + 0.75*15, 3), -0.375 + 0.75*(15:0), rep(-0.375+0, 3),
-0.375 + 0.75*(0:15), rep(-0.375 + 0.75*15, 3), -0.375 + 0.75*(15:0), rep(-0.375+0, 3),
-0.375 + 0.75*(0:15), rep(-0.375 + 0.75*15, 3), -0.375 + 0.75*(15:0), rep(-0.375+0, 3),
-0.375 + 0.75*(0:15), rep(-0.375 + 0.75*15, 3), -0.375 + 0.75*(15:0)
You can’t perform that action at this time.