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 / .Rprofile.r
Last active December 28, 2015 04:39
My .Rprofile for Mac
#########################################
# Last update: 2014-05-17
#########################################
if (capabilities("aqua")) {
options(device="quartz")
}
setHook(packageEvent("grDevices", "onLoad"),
function(...) {
if (.Platform$OS.type == "windows")
grDevices::windowsFonts(sans ="MS Gothic",
@uribo
uribo / frequency histogram.r
Created December 6, 2013 18:01
Frequency histogram with negative value.
d.class <- seq(25, 200, by=25) # DBH class
class <- c()
for(i in 1 : (length(d.class) - 1)){
class <- append(class, paste(d.class[i], "-" ,d.class[i + 1], "cm"))
}
imm.class1 <- c(30, 20, 10, 5, 0, 0, 0)
imm.class2 <- c(0, 0, 5, 10, 5, 0, 0)
imm.class3 <- c(0, 0, 0, 0, 5, 2, 0)
immature <- matrix(
@uribo
uribo / 1Introduction.tex
Last active January 1, 2016 10:38
俺俺修士論文用TeXファイルの設定
%#!platex Draft.tex
\section{Introduction}
hogehoge.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@uribo
uribo / contributions_calendar_data.json
Created June 6, 2014 12:47
cal-heatmapモジュールで利用するjsonファイルの取得
[["2013/06/06",0],["2013/06/07",0],["2013/06/08",0],["2013/06/09",0],["2013/06/10",0],["2013/06/11",0],["2013/06/12",0],["2013/06/13",0],["2013/06/14",0],["2013/06/15",0],["2013/06/16",0],["2013/06/17",0],["2013/06/18",0],["2013/06/19",0],["2013/06/20",0],["2013/06/21",0],["2013/06/22",0],["2013/06/23",0],["2013/06/24",0],["2013/06/25",0],["2013/06/26",0],["2013/06/27",0],["2013/06/28",0],["2013/06/29",0],["2013/06/30",0],["2013/07/01",0],["2013/07/02",2],["2013/07/03",1],["2013/07/04",0],["2013/07/05",0],["2013/07/06",0],["2013/07/07",0],["2013/07/08",0],["2013/07/09",0],["2013/07/10",0],["2013/07/11",0],["2013/07/12",0],["2013/07/13",0],["2013/07/14",0],["2013/07/15",0],["2013/07/16",0],["2013/07/17",0],["2013/07/18",0],["2013/07/19",0],["2013/07/20",0],["2013/07/21",0],["2013/07/22",0],["2013/07/23",0],["2013/07/24",0],["2013/07/25",0],["2013/07/26",0],["2013/07/27",0],["2013/07/28",0],["2013/07/29",0],["2013/07/30",0],["2013/07/31",0],["2013/08/01",0],["2013/08/02",0],["2013/08/03",0],["2013/08/04",0],["2
@uribo
uribo / chunk-option.Rmd
Created June 7, 2014 08:57
for r graphics plotting
```{r global_option, include=FALSE}
opts_chunk$set(
fig.width=6, fig.height=6,
out.width=500,
dpi=150)
```
@uribo
uribo / default.latex
Created June 24, 2014 09:00
RStudioを使ったPDF文書の作成
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
$if(fontfamily)$
\usepackage{$fontfamily$}
$else$
\usepackage{lmodern}
$endif$
$if(linestretch)$
\usepackage{setspace}
\setstretch{$linestretch$}
$endif$
@uribo
uribo / mkdir.R
Last active August 29, 2015 14:03
makeup your owe research project
#########################################
# Name: My Research Project Directory
# Creation Date: July 8, 2014
# Update Date: June 17, 2015
# Version: 0.1.2
# Author: Shinya Uryu
# Gist: https://gist.github.com/uribo/51602ed9295b730c5bc2
# Description: Create research project structure
# Usage:
# 0. install.packages(tcltk)
@uribo
uribo / read.multi.csv.r
Created July 22, 2014 13:52
read multi cdv files
for (i in year) {
mypath <- file.path(getwd(), paste("H", i, ".csv", sep = ""))
assign(paste("df", i, sep = ""), read.csv(mypath, header = T)) # ダミー変数(df10, df11 ... df23)を作成して各CSVファイルを読み込む
}
@uribo
uribo / generate-abbreviation.r
Last active August 29, 2015 14:05
学名の属名と種小名から略称を生成する関数
library(stringr)
# お試しデータフレームの作成
df <- data.frame(
Species = c("Quercus serrata", "Quercus acuta", "Fagus crenata", "Viburnum odoratissimum var. awabuki"),
DBH = c(30, 35, 37, 18))
# 関数の定義
get.abb <- function (species, genus.max = 2, spsn.max = 2, sep = "."){
species <- as.character(species)