Skip to content

Instantly share code, notes, and snippets.

View uribo's full-sized avatar
🍉
fine

Shinya Uryu uribo

🍉
fine
View GitHub Profile
{
"schemaVersion": 1,
"label": "徳島大学附属図書館",
"message": "蔵書あり",
"color": "green"
}
[{"lib":"Univ_Tokushima","reserveurl":"","libkey":"蔵書なし"},{"lib":"Tokushima_Tokushima","reserveurl":"https://opac.lib.tokushima-u.ac.jp/opac/volume/1382750","libkey":"蔵書あり"},{"lib":"Tokushima_Pref","reserveurl":"","libkey":"蔵書なし"}]
library(httr2)
library(rvest)
# ページリスト ------------------------------------------------------------------
req <-
request("https://scrapbox.io/") |>
req_url_path_append("api/pages/") |>
req_url_path_append("mandaRa")
x <-
req |>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@uribo
uribo / estat_toukei_00500215.R
Created February 23, 2023 07:53
作物統計調査のデータをダウンロードして綺麗な形でRに読み込む
##############################
# 作物統計調査のデータをダウンロードして綺麗な形でRに読み込む
# 表分類: 品目別結果樹面積、収穫量及び出荷量累年統計(昭和48年~)
##############################
# 1. 対象のデータを一覧にする ---------------------------------------------------------
base_url <- "https://www.e-stat.go.jp"
df_item <-
seq.int(2) |>
purrr::map(
@uribo
uribo / URL
Last active December 8, 2022 01:29
https://mybinder.org/v2/gh/uribo/binder221202/main?urlpath=git-pull?repo=https://github.com/uribo/cue2022aw_r104
@uribo
uribo / zip_to_administration.R
Last active September 28, 2022 04:32
郵便番号から該当する都道府県・市区町村・町域名、jis codeを検索
read_zipcode_oogaki <-
memoise::memoise(
function(.path) {
dplyr::select(zipangu::read_zipcode(.path,
type = "oogaki"),
jis_code, zip_code, prefecture, city, street)
}
)
zip_to_administration <- function(x, value = "jis_code", .path = NULL) {
apple_book_name_fix <- function(data) {
purrr::set_names(data,
stringr::str_to_lower(
stringr::str_remove(names(data), "^Z")
))
}
apple_book_markers <- function() {
con <- DBI::dbConnect(RSQLite::SQLite(),
"~/Library/Containers/com.apple.iBooksX/Data/Documents/AEAnnotation/AEAnnotation_v10312011_1727_local.sqlite",
@uribo
uribo / vis_tide_level.R
Last active October 7, 2021 21:43
複数地点の潮位データをプロット
library(dplyr)
library(jmastats)
library(ggplot2)
library(ggforce)
# 対象地点のデータを取得 -------------------------------------------------------------
# 東京
df_tk <-
read_tide_level(.year = 2020, .month = 8, .stn = "TK")
@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 <-