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 / maff_disaster1964-2020.R
Last active August 27, 2021 03:09
農林水産省 過去の主な異常災害等と農林水産被害
######################################
# 農林水産省 過去の主な異常災害等と農林水産被害
# http://www.maff.go.jp/j/saigai/arc/index-1.html
######################################
# 1/3 Setup -------------------------------------------------------------------
library(dplyr)
library(purrr)
library(stringr)
bind_line2df <- function(x, index) {
x[index] %>%
@uribo
uribo / read_senkyo_s_shikuchouson.R
Last active August 24, 2021 03:34
衆議院議員総選挙のデータを扱う関数
# 市区町村別得票数
read_senkyo_s_shikuchouson <- function(path, sheet = 1) {
df_raw <-
readxl::read_excel(path,
sheet = sheet,
skip = 3)
df_raw <-
df_raw %>%
dplyr::filter(!is.na(`候補者名`))
x_candidate <-
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@uribo
uribo / jma_normal_phenology.R
Created March 31, 2021 14:47
生物季節観測 さくらの開花日・満開日の期間
####################################
# 月*100+日
# 9月5日 --> 905
####################################
library(readr)
library(dplyr)
library(ggplot2)
library(ggalt)
d <-
read_csv("~/Downloads/normal_phenology/nml_phenology.csv",
@uribo
uribo / electric_usage_calendar.R
Created March 25, 2021 13:36
電力使用率をmoon chartsで表現する🌖⚡️
library(dplyr)
library(readr)
library(ggplot2)
library(gggibbous)
library(ggtext)
d <-
read_csv("https://www.tepco.co.jp/forecast/html/images/juyo-result-j.csv",
skip = 2,
locale = locale(encoding = "cp932"))
@uribo
uribo / zipangu210201.R
Last active February 2, 2021 00:26
zipangu v0.2.2
####################################
# zipangu v0.2.2
####################################
library(zipangu)
library(ggplot2)
library(patchwork)
theme_set(theme_bw(base_family = suryulib::jpfont(), base_size = 6))
# ベクトル化 -------------------------------------------------------------------
convert_jdate(c("令和3年2月1日", "令和元年5月1日", "平31年4月1日"))
@uribo
uribo / japan_one_twenty_map.topojson
Last active December 8, 2020 12:40
Geojson Japan Map
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@uribo
uribo / jma_record_temp.R
Last active August 25, 2020 13:03
気象庁 観測史上の記録
####################################
# 気象庁 観測史上の記録
####################################
library(tidyverse)
library(jmastats) # remotes::install_gitlab("uribo/jmastats")
library(ggalt)
library(sf)
library(patchwork)
tgt_st_block_no <- c("47418", "47407", "47412", "47575", "47582", "47590", "47615", "47662",
library(dplyr)
library(jmastats)
library(ggplot2)
source("https://raw.githubusercontent.com/uribo/japan-heatstroke/master/R/read_moe_wbgt.R")
wbgt_list1 <-
c(l1_lv5 = "#ff2800",
l1_lv4 = "#ff9600",
l1_lv3 = "#faf500",
l1_lv2 = "#a0d2ff",
@uribo
uribo / Transport_flowmap.R
Created July 17, 2020 09:52
Transport census flowmap
###################################
# 大都市交通センサス
# 第12回 首都圏 https://www.mlit.go.jp/sogoseisaku/transport/sosei_transport_tk_000007.html
# 線別駅間移動人員,
# 鉄道位置データ: 国土数値情報 鉄道時系列 https://nlftp.mlit.go.jp/ksj/gml/datalist/KsjTmplt-N05-v1_3.html
# 行政区画: 地球地図日本 https://www.gsi.go.jp/kankyochiri/globalmap.html
# 加工・編集者: 瓜生真也 (Shinya Uryu)
#
# mapboxよりアクセストークンを取得してください
###################################