Skip to content

Instantly share code, notes, and snippets.

View emitanaka's full-sized avatar

Emi Tanaka emitanaka

View GitHub Profile
@emitanaka
emitanaka / bitmap.R
Last active August 24, 2018 21:11
Making the Rladies Sydney Bitmap Animation
library(readbitmap)
library(gganimate)
library(dplyr)
library(ggplot2)
b1 <- read.bitmap("~/Documents/rladies.png")
b2 <- read.bitmap("~/Documents/sydney.png")
x1 <- 1 - b1[,,1]
x2 <- 1 - b2[,,1]
# plot(raster::raster(x1)) # check
# plot(raster::raster(x2)) # check
@emitanaka
emitanaka / ggplot_tutorial.Rmd
Last active March 30, 2020 04:02
ggplot tutorial with kunoichi + ninjutsu xaringan theme
---
title: "ggplot tutorial"
subtitle: "with kunoichi + ninjutsu theme"
author: "<br><br> Emi Tanaka"
date: "<br>2018/09/16"
output:
xaringan::moon_reader:
lib_dir: libs
css: ["kunoichi", "ninjutsu"]
nature:
@emitanaka
emitanaka / emoji_calendar_2018.R
Created October 28, 2018 05:44
Emoji Calendar Plot
library(tidyverse)
library(lubridate)
library(sugrrants)
library(emojifont)
load.emojifont('OpenSansEmoji.ttf')
happy <- c("\U0001f606", "\U0001f603", "\U0001f64b", "\U0001f604", "\U0001f600")
sad <- c("\U0001f63f", "\U0001f622", "\U0001f62d", "\U0001f61e", "\U0001f64d")
neutral <- c("\U0001f47e", "\U0001f43a", "\U0001f438")
@emitanaka
emitanaka / harvest.R
Created November 22, 2018 03:30
Tractor harvesting
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)
@emitanaka
emitanaka / custom.css
Created January 4, 2019 06:34
For fixing printing from chrome for xaringan
/*
Below is for 16:9. Adjust to suit your own.
*/
@page {
size: 1210px 681px;
margin: 0;
}
@media print {
.remark-slide-scaler {
@emitanaka
emitanaka / graph.R
Created January 30, 2019 11:53
child geom point plot for CY
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 / IBSlogo_animation.R
Created April 19, 2019 12:03
IBS Logo Animation
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 / hadleyinsydney.R
Last active May 1, 2019 11:23
Hadley in Sydney Public Lecture
# the power of piping + functional programming + stringr + some gluing <3
library(tidyverse)
tidyverse <- "Hadley"
"You're" -> Hadley
"super" -> Thanks
"{tidyverse} is awesome" %>%
str_glue() %>%

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 / collapseoutput.js
Created July 20, 2019 04:43
Collapsible Code Output for `xaringan`
<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() {