This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Query the raw data | |
# https://dbs.manhica.net:4843/dhis/api/27/dataValueSets.json?orgUnit=gA8TPImqcD3&period=2017W30&dataSet=KrDJDTu8M7j&children=true | |
rd <- jsonlite::fromJSON(txt = 'data/rrs/rd.json')$dataValues | |
# Query the organization units | |
# https://dbs.manhica.net:4843/dhis/api/27/dataValueSets.json?orgUnit=gA8TPImqcD3&period=2017W30&dataSet=KrDJDTu8M7j&children=true | |
ou <- jsonlite::fromJSON(txt = 'data/rrs/ou.json')$dataValues | |
# Then get data elements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define a function for adding zerio | |
add_zero <- | |
function (x, n) | |
{ | |
x <- as.character(x) | |
adders <- n - nchar(x) | |
adders <- ifelse(adders < 0, 0, adders) | |
for (i in 1:length(x)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Map the world | |
map('world', | |
xlim = c(-90, -10), | |
ylim = c(10, 40), | |
fill = TRUE, | |
col = adjustcolor('black', alpha.f = 0.6)) | |
# Add Irma | |
lines(irma) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Process hurricanes data | |
hurricanes <- | |
hurricanes %>% | |
mutate(year = Season) %>% | |
# Keep only those since 1917 | |
filter(year >= 1917) %>% | |
mutate(date_time = ISO_time, | |
lon = Longitude, | |
lat = Latitude, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Libraries | |
library(tidyverse) | |
library(rworldmap) | |
library(gganimate) | |
library(rgdal) | |
# Read data | |
world <- map_data(map="world") | |
hurricanes <- read_csv('data/Allstorms.ibtracs_wmo.v03r09.csv', skip = 1) # https://www.ncdc.noaa.gov/ibtracs/index.php?name=wmo-data | |
cnames <- names(hurricanes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define function for leaflet plot of only a country | |
leaf_country <- function(location, | |
limit = NULL, | |
city = FALSE){ # or NULL | |
if(city){ | |
sub_data <- df %>% | |
filter(city == location) | |
} else { | |
sub_data <- df %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(rworldmap) | |
library(sp) | |
library(feather) | |
library(leaflet) | |
library(maptools) | |
library(rgeos) | |
library(rgdal) | |
library(htmltools) | |
library(htmlwidgets) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
# https://github.com/fawda123/rStrava | |
library(rStrava) | |
library(yaml) | |
library(feather) | |
options(scipen = '999') | |
# Get access / authentication token for Strava's API | |
credentials <- yaml::yaml.load_file(input = 'credentials/credentials.yaml') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.