Skip to content

Instantly share code, notes, and snippets.

View hrstt's full-sized avatar

sato hiroyuki hrstt

View GitHub Profile
@hrstt
hrstt / icd10list_NtoZ.tsv
Created October 18, 2016 05:04
ICD10 国際疾病分類第10版(2003年改訂) # ref: http://www.dis.h.u-tokyo.ac.jp/byomei/icd10/
We can't make this file beautiful and searchable because it's too large.
ICD10(except dot) ICD10 name order topcategory
N00 N00 急性腎炎症候群 14 尿路性器系の疾患
N000 N00.0 急性腎炎症候群,軽微糸球体変化 14 尿路性器系の疾患
N001 N00.1 急性腎炎症候群,巣状及び分節状糸球体変化 14 尿路性器系の疾患
N002 N00.2 急性腎炎症候群,びまん性膜性糸球体腎炎 14 尿路性器系の疾患
N003 N00.3 急性腎炎症候群,びまん性メザンギウム増殖性糸球体腎炎 14 尿路性器系の疾患
N004 N00.4 急性腎炎症候群,びまん性管内増殖性糸球体腎炎 14 尿路性器系の疾患
N005 N00.5 急性腎炎症候群,びまん性メザンギウム毛細管性糸球体腎炎 14 尿路性器系の疾患
N006 N00.6 急性腎炎症候群,デンスデポジット病 14 尿路性器系の疾患
N007 N00.7 急性腎炎症候群,びまん性半月体形成性糸球体腎炎 14 尿路性器系の疾患
@hrstt
hrstt / summing_runif_is_instead_of_rnorm.R
Created November 11, 2016 00:38
一様分布の和の平均は正規分布の近似に使える(中心極限定理)
sum_runif <- function(x) {
a <- runif(n = 1000)
if (x <= 1) return(a)
else return(a + Recall(x-1))
}
hist(sum_runif(5))
hist(sum_runif(1))
hist(sum_runif(10))
@hrstt
hrstt / merge_each_excel_sheets.r
Created November 11, 2016 00:43
複数のExcelシートにデータがある場合にそれらを結合する(同一の列構成である前提)
install.packages("xlsx")
library("xlsx")
n <- 10
a <- list()
for(i in 1:n) {
a[[i]] <- read.xlsx("data.xlsx", sheetIndex=i, encoding="UTF-8", header = FALSE)
}
data <- do.call(rbind, a)
library("tidyverse")
library("dummies")
iris %>% select(Species) %>% dummy.data.frame(., c("Species"), sep="_")
@hrstt
hrstt / chisq.test.by.tidy.R
Last active November 29, 2019 01:36
for chisq.test, convert count data to matrix with tidyverse
library(tidyverse)
tidyToChisq <- function(data, col, row) {
return(
data %>% group_by_(col, row) %>%
summarise(count = n()) %>% spread(row, count, fill = 0) %>%
ungroup() %>% select(-starts_with(col)) %>% as.matrix() %>% chisq.test())
}
@hrstt
hrstt / japanese_holidays.r
Created October 21, 2024 10:19
日本の休日一覧を内閣府からとってくる
library('tidyverse')
locale(
date_names = "en",
date_format = "%AD",
time_format = "%AT",
decimal_mark = ".",
grouping_mark = ",",
tz = "Asia/Tokyo",
encoding = "CP932",