Skip to content

Instantly share code, notes, and snippets.

View Ryo-N7's full-sized avatar

Ryo Nakagawara Ryo-N7

View GitHub Profile
@Gedevan-Aleksizde
Gedevan-Aleksizde / heatmap.R
Created July 22, 2018 16:15
気象庁からダウンロードした気温データでヒートマップ作成する
require(tidyverse)
require(ggthemes)
require(rjson)
require(jsonlite)
# 参考
# https://www.data.jma.go.jp/gmd/risk/obsdl/index.php
# https://www.data.jma.go.jp/gmd/risk/obsdl/top/help3.html#hukajoho
# https://twitter.com/mehori/status/1020644999703089152
library(rnaturalearth)
library(sf)
library(plotly)
library(crosstalk)
library(viridis)
ng <- ne_states(country = "Nigeria", returnclass = "sf") %>%
select(Name = name)
# Source: https://dhsprogram.com/pubs/pdf/FR293/FR293.pdf
library(tidyverse)
gpi <- jsonlite::fromJSON("http://staging-maps.visionofhumanity.org/json_feeds/gpi.json?v=2.6.12&vv=2.6.12")
map(gpi, "csv") %>%
map_df(~read_csv(sprintf("http://staging-maps.visionofhumanity.org/csv/%s", .x))) %>%
docxtractr::mcga() -> gpi_df
glimpse(gpi_df)
## Observations: 1,618
# The packages we'll be using
packages <- c("rvest","dplyr","tidyr","pipeR","ggplot2","stringr","data.table")
# From those packages, which ones are not yet installed?
newPackages <- packages[!(packages %in% as.character(installed.packages()[,"Package"]))]
# If any weren't already installed, install them now
if(length(newPackages)) install.packages(newPackages)
# Now make sure all necessary packages are loaded