Skip to content

Instantly share code, notes, and snippets.

🍉
fine

Shinya Uryu uribo

🍉
fine
Block or report user

Report or block uribo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View blackdown_typhoon15_chiba1909.R
#############################################
# 東京電力街が提供する千葉県内の停電状況
#############################################
library(dplyr)
library(sf)
library(ggplot2)
library(rcartocolor)
library(ggrepel)
library(gridExtra)
@uribo
uribo / kameiten_list.R
Created Sep 7, 2019
キャッシュレス消費者還元事業登録リストのデータフレーム化
View kameiten_list.R
library(tidyverse)
library(tabulizer)
tweak_kameiten_df <- function(data) {
data %>%
dplyr::filter(!is.na(`No.`)) %>%
dplyr::mutate(還元率 = units::set_units(還元率, "%")) %>%
dplyr::arrange(`No.`) %>%
tibble::as_tibble()
}
kameiten_na <- function() {
@uribo
uribo / h3forr_sample.R
Last active Sep 3, 2019
h3forrお試し
View h3forr_sample.R
library(h3forr)
library(jpmesh)
library(sf)
library(dplyr)
library(mapview)
sfc_poly_to_h3 <- function(geometry, res = 7) {
coords <- sf::st_coordinates(sf::st_centroid(st_geometry(geometry)))
h3forr::geo_to_h3(c(coords[2], coords[1]), res = res)
}
@uribo
uribo / andosan_chicklet_plot.R
Last active Aug 10, 2019
Go Andoさんのおしゃれな図をRで
View andosan_chicklet_plot.R
# Original: Go Ando (@goando) https://twitter.com/goando/status/1159674083363053568
# 1枚目 ---------------------------------------------------------------------
library(ggrepel)
library(ggchicklet)
library(tidyverse)
df_label <-
tibble(
x = c(6, 20),
y = c(215, 40),
@uribo
uribo / ds_view.R
Last active Jun 12, 2019
Data Science Color Palette
View ds_view.R
library(ggplot2)
theme_set(theme_light(base_size = 14,
base_family = dplyr::if_else(grepl("mac", sessioninfo::os_name()),
"IPAexGothic",
"IPAGothic")))
ds_col <- function(...) {
.ds_cols <-
c(`cave` = "#F4A935",
View subset_kanto_citycode.R
subset_kanto_citycode <- function(data, city_code, .honsyu = TRUE) {
d <-
data %>%
# 関東 (一都六県) %>%
dplyr::filter(stringr::str_detect(!!rlang::enquo(city_code),
paste0("^(",
paste(stringr::str_pad(seq(8, 14), width = "2", pad = "0"), collapse = "|"),
")")))
if (rlang::is_true(.honsyu)) {
d <-
@uribo
uribo / population_and_flood_damage_biscale.R
Last active Jun 4, 2019
東京23区1kmメッシュにおける人口総数と想定浸水深の可視化
View population_and_flood_damage_biscale.R
library(sf)
library(ensurer)
library(assertr)
library(dplyr)
library(fgdr)
library(jpmesh)
library(readr)
library(ggplot2)
library(cowplot)
library(biscale)
@uribo
uribo / build_req_url.R
Last active Jul 8, 2019
zipangu: 国土数値情報データをR上で扱いやすい形式にパースする
View build_req_url.R
build_req_url <- function(api = c("getKSJSummary", "getKSJURL"), ...) {
query <- NULL
rlang::arg_match(api)
req_url <-
glue::glue(
"http://nlftp.mlit.go.jp/ksj/api/{version}/index.php/app/{api}.xml?appId={app_id}&lang={lang}&dataformat={data_format}",
version = "1.0b",
app_id = "ksjapibeta1",
View ksj_collect_n03.R
zip_n03_url <- function(year, pref_code) {
year <- as.character(year)
year <- rlang::arg_match(year,
values = as.character(c(1920L,
seq.int(1950, 1985, by = 5L),
seq.int(1995, 2005, by = 5L),
seq.int(2006, 2018, by = 1L))))
View jgd2011.R
library(dplyr)
library(sf)
# 6669:6687 %>%
# purrr::map(
# jgd2011_bbox_coords
# ) %>%
# purrr::set_names(c(paste0("epsg_", 6669:6687))) %>% dput()
jgd2011_bbox <-
list(
You can’t perform that action at this time.