Skip to content

Instantly share code, notes, and snippets.

View uribo's full-sized avatar
🍉
fine

Shinya Uryu uribo

🍉
fine
View GitHub Profile
@uribo
uribo / ggplot2-for-jp.r
Last active August 29, 2015 14:08
ggplot2で日本語(for Mac)
qplot(DBH, Height,
data = kn26,
colour = Jp.Species) +
theme_grey(base_family="HiraMaruProN-W4")
@uribo
uribo / read_seq_csv.r
Last active August 29, 2015 14:10
read sequence .csv files.
library(dplyr)
seqence.number <- c(2012:2014)
for (i in seqence.number) {
mypath <- file.path(getwd(), paste(i, ".csv", sep = ""))
assign(
paste("df", i, sep = ""),
read.csv(mypath, header = T) %>%
mutate(ID = i))
}
@uribo
uribo / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@uribo
uribo / get_palette.r
Created December 7, 2014 03:41
Generate Dribbble color palette
get_palette <- function (url, col.n = 8) {
url <- html(url)
cols <- url %>%
html_nodes("ul.color-chips li a") %>%
html_attr("title")
cols[1:col.n]
na.omit(cols)
}
# 'usage
@uribo
uribo / get_shot_palette.r
Last active August 29, 2015 14:10
Generate Dribbble color palette form genre
get_shot_palette <- function (col.n = 8, genre = c("debut", "recent", "teams", "playoffs", "animated")) {
base.url <- c("https://dribbble.com")
request.url <- html(paste(base.url, "/shots?list=", genre, sep = "")) %>%
html_nodes(".dribbble-img a") %>%
html_attr("href") %>%
head(1)
request.url <-paste(base.url, request.url, sep = "")
@uribo
uribo / header.tex
Created January 29, 2015 13:16
test 150129
\usepackage{fancyhdr}
\usepackage{fourier-orns}
\usepackage{lscape}
\usepackage{zxjatype}
\setjamainfont{Hiragino Kaku Gothic Pro}
\usepackage{soul}
\pagestyle{fancy}
\lhead{\slshape \rightmark} \rhead{\slshape \today}
\usepackage{fontspec, fontawesome} % require installed FontAwesome
\newcommand{\HLT}[1]{\hl{{\bf \mbox{#1}}}}
@uribo
uribo / tweet_gyotaku.R
Last active August 29, 2015 14:14
twitter gyotaku using webshot.pkg
library("webshot") # https://github.com/wch/webshot
webshot("https://twitter.com/u_ribo/status/561669079430201344", "test150201.png",
selector = ".expansion-container") # select CSS
@uribo
uribo / with_emoji.R
Last active October 30, 2015 21:07
R source code with emoji
# 🔧_option
theme_set(theme_classic(base_size = 18, base_family = "Helvetica"))
# 📦_using_packages
library("dplyr", warn.conflicts = FALSE) # 🚧 avoid package conflict
library("ggplot2")
library("magrittr")
# ⭐_setup
df <- iris %>% filter(Sepal.Width < mean(Sepal.Width), Petal.Width < mean(Petal.Width))
@uribo
uribo / rmarkdown_hack.Rmd
Created February 11, 2015 14:24
multiple authors, citation and save image png format
---
title: AWESOME TITLE
author:
- ME
- YOU
output:
beamer_presentation:
fonttheme: "structurebold"
pandoc_args:
["--latex-engine=xelatex"]
@uribo
uribo / advise.md
Last active August 29, 2015 14:15 — forked from hadley/advise.md

I think the two most important messages that people can get from a short course are:

a) the material is important and worthwhile to learn (even if it's challenging), and b) it's possible to learn it!

For those reasons, I usually start by diving as quickly as possible into visualisation. I think it's a bad idea to start by explicitly teaching programming concepts (like data structures), because the pay off isn't obvious. If you start with visualisation, the pay off is really obvious and people are more motivated to push past any initial teething problems. In stat405, I used to start with some very basic templates that got people up and running with scatterplots and histograms - they wouldn't necessary understand the code, but they'd know which bits could be varied for different effects.

Apart from visualisation, I think the two most important topics to cover are tidy data (i.e. http://www.jstatsoft.org/v59/i10/ + tidyr) and data manipulation (dplyr). These are both important for when people go off and apply