Skip to content

Instantly share code, notes, and snippets.

✍️

Sam Abbott seabbs

✍️
Block or report user

Report or block seabbs

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
@seabbs
seabbs / data-read-plus-munge
Last active Jul 10, 2019
Read in, munge and save a set of csvs + profiling information
View data-read-plus-munge
# 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")
@seabbs
seabbs / spending_gap_normalised
Created Jun 7, 2019
Looking at normalised spending gap for global Tuberculosis funding
View spending_gap_normalised
# 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
@seabbs
seabbs / spending_gap
Last active Jun 5, 2019
Looking at the expenditure and funding gap for TB
View spending_gap
# Install and load the package --------------------------------------------
#Use install.packages(c("getTBinR", "dplyr", "getTBinR")) to get required packages
library(getTBinR) #TB data + visualisations
library(dplyr) # For data manipulation
library(ggplot2) # For additional visualisations etc.
#For storyboards - install with commented out code
# install.packages("devtools")
# devtools::install_github("thomasp85/patchwork")
@seabbs
seabbs / benchmark-trest
Created Feb 11, 2019
Test of benchmarkme functionality.
View benchmark-trest
## Load latest CRAN version of benchmarkme
library(benchmarkme)
## Run a benchmark for a single core
single_perf <- benchmark_std()
## Run a benchmark on multiple cores (here 4)
mutli_perf <- benchmark_std(cores = 4)
@seabbs
seabbs / tidyverse-gpu-dockerfile
Last active Jan 25, 2019
A GPU enabled Tidyverse Dockerfile
View tidyverse-gpu-dockerfile
FROM rocker/tidyverse:latest
MAINTAINER "Sam Abbott" contact@samabbott.co.uk
## Shell tools
RUN apt-get update && apt-get install -y --force-yes --allow-unauthenticated --no-install-recommends --no-upgrade \
curl \
## R package dependencies
@seabbs
seabbs / gpu-test
Created Jan 25, 2019
Testing GPU set up in R for machine learning
View gpu-test
library(xgboost)
# load data
data(agaricus.train, package = 'xgboost')
data(agaricus.test, package = 'xgboost')
train <- agaricus.train
test <- agaricus.test
# fit model
bst <- xgboost(data = train$data, label = train$label, max_depth = 5, eta = 0.001, nrounds = 1000,
nthread = 2, objective = "binary:logistic", tree_method = "gpu_hist")
# predict
@seabbs
seabbs / gpu-test
Created Jan 25, 2019
Testing GPU set up in R for machine learning
View gpu-test
library(xgboost)
# load data
data(agaricus.train, package = 'xgboost')
data(agaricus.test, package = 'xgboost')
train <- agaricus.train
test <- agaricus.test
# fit model
bst <- xgboost(data = train$data, label = train$label, max_depth = 5, eta = 0.001, nrounds = 1000,
nthread = 2, objective = "binary:logistic", tree_method = "gpu_hist")
# predict
@seabbs
seabbs / storyboard-gettbinr-2017
Last active May 23, 2019
Storyboard for GetTBinR 2017 data
View storyboard-gettbinr-2017
## Get required packages - managed using pacman
if (!require(pacman)) install.packages("pacman"); library(pacman)
p_load("getTBinR")
p_load("ggplot2")
p_load("ggrepel")
p_load("scales")
p_load("viridis")
p_load("dplyr")
p_load("tidyr")
p_load("forcats")
@seabbs
seabbs / playing_with_gams_in_tb
Created Sep 11, 2018
Playing with an example GAM model using TB data
View playing_with_gams_in_tb
if (!require("pacman")) install.packages("pacman")
p_load("getTBinR")
p_load("tidyverse")
p_load("mgcv")
p_load("zoo")
tb <- get_tb_burden()
tb_features <- tb %>%
filter(e_inc_100k >= 200, e_inc_num > 100) %>%
@seabbs
seabbs / nginx-conf
Created Aug 8, 2018
Nginx conf generated by nginx auto proxy
View nginx-conf
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
# scheme used to connect to this server
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
default $http_x_forwarded_proto;
'' $scheme;
}
# If we receive X-Forwarded-Port, pass it through; otherwise, pass along the
# server port the client connected to
map $http_x_forwarded_port $proxy_x_forwarded_port {
default $http_x_forwarded_port;
You can’t perform that action at this time.