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
#!/bin/bash | |
TODAY=`date +%Y-%m-%d` | |
TODAY_MD=`date +%B\ %d,\ %Y` | |
YEAR=`date +%Y` | |
PACKAGENAME=$1 | |
## | |
## CHANGE ME!!! |
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(plotly) | |
library(shiny) | |
# compute a correlation matrix | |
correlation <- round(cor(mtcars), 3) | |
nms <- names(mtcars) | |
ui <- fluidPage( | |
mainPanel( | |
plotlyOutput("heat"), |
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
# Install and load the package -------------------------------------------- | |
if(!require(pacman))install.packages("pacman") | |
pacman::p_load('dplyr', 'ggplot2', 'getTBinR') | |
pacman::p_load_gh('thomasp85/patchwork') | |
pacman::p_load_gh('bbc/bbplot') | |
# Look at available datasets\ --------------------------------------------- | |
available_datasets |
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
## For password management | |
git config --global user.email "s.e.abbott12@gmail.com" | |
git config --global user.name "Sam Abbott" | |
git config --global credential.helper cache | |
git remote set-url origin https://github.com/USERNAME/REPOSITORY.git | |
# github settings | |
# developer settings | |
# create access token and copy | |
# git pull/push |
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
# Get required packages - managed using pacman --------------------------- | |
# This installs packages if they are missing and otherwise loads them. | |
if (!require(pacman)) install.packages("pacman"); library(pacman) | |
p_load("tidyverse") | |
p_load("fs") | |
p_load("data.table") | |
p_load("lubridate") | |
p_load("purrr") | |
p_load("furrr") |
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(future) | |
# ////////////////////////////////////////////////////////////////////////////// | |
# Fresh R session takes around 40MB | |
pryr::mem_used() | |
#> Registered S3 method overwritten by 'pryr': | |
#> method from | |
#> print.bytes Rcpp | |
#> 35.7 MB |
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(data.table) | |
library(ggplot2) | |
cases <- fread('_nowcasts/covid-global/national-summary/cases.csv') | |
df <- fread('_nowcasts/covid-global/national-summary/rt.csv') | |
continents <- fread('_nowcasts/covid-global/data/continents_cnty.csv') | |
cases <- cases[, .(country, date, cases = median)] | |
dfcont <- merge(df, continents, by.x = "country", by.y = "country_name", all.x = TRUE) | |
dfcont <- merge(dfcont, cases, by = c("country", "date"), all.x = TRUE) |
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(ggplot2) | |
library(tibble) | |
df <- tribble( | |
~x, ~y, ~label, | |
1, 2, "A super long label oh god how am I going to deal with this", | |
2, 1, "A shorter one" | |
) | |
# Default - text is cut off |
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("gh") | |
library("vroom") | |
owner <- "epiforecasts" | |
repo <- "covid-rt-estimates" | |
path <- "subnational/united-kingdom-local/cases/summary/rt.csv" | |
rt_commits <- | |
gh("/repos/{owner}/{repo}/commits?path={path}", | |
owner = owner, |
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
##' Get estimates shown at \url{https://epiforecasts.io/covid} for all times | |
##' | |
##' Nowcasts at \url{https://epiforecasts.covid} and the related github repository at | |
##' \url{https://github.com/epiforecasts/covid-rt-estimates} only cover the last 3 | |
##' months. This function downloads all available estimates and applies a median | |
##' average to the provided quantiles to provide an estimate of a time series | |
##' covering all times available | |
##' | |
##' @param dataset character; data set corresponding to directories at | |
##' \url{https://github.com/epiforecasts/covid-rt-estimates}. Default is |
OlderNewer