Skip to content

Instantly share code, notes, and snippets.

View jarvisc1's full-sized avatar

Chris jarvisc1

  • LSHTM
View GitHub Profile
library(skimr)
skim(mtcars)
skim_mtcars <- skim(mtcars)
names(skim_mtcars)
summary(skim_mtcars)
skim(mtcars, mpg)
mtcars %>%
@jarvisc1
jarvisc1 / aa_plot_continent.r
Last active May 26, 2020 16:28
Plot range of Rt for continents
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)
The MIT License (MIT)
Copyright (c) 2016 AcornHack
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@jarvisc1
jarvisc1 / server.R
Created March 19, 2016 08:23
PintOfScienceMap
#
# This is the server logic of a Shiny web application. You can run the
# application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="data:application/x-javascript;base64,KGZ1bmN0aW9uKCkgewogIC8vIElmIHdpbmRvdy5IVE1MV2lkZ2V0cyBpcyBhbHJlYWR5IGRlZmluZWQsIHRoZW4gdXNlIGl0OyBvdGhlcndpc2UgY3JlYXRlIGEKICAvLyBuZXcgb2JqZWN0LiBUaGlzIGFsbG93cyBwcmVjZWRpbmcgY29kZSB0byBzZXQgb3B0aW9ucyB0aGF0IGFmZmVjdCB0aGUKICAvLyBpbml0aWFsaXphdGlvbiBwcm9jZXNzICh0aG91Z2ggbm9uZSBjdXJyZW50bHkgZXhpc3QpLgogIHdpbmRvdy5IVE1MV2lkZ2V0cyA9IHdpbmRvdy5IVE1MV2lkZ2V0cyB8fCB7fTsKCiAgLy8gU2VlIGlmIHdlJ3JlIHJ1bm5pbmcgaW4gYSB2aWV3ZXIgcGFuZS4gSWYgbm90LCB3ZSdyZSBpbiBhIHdlYiBicm93c2VyLgogIHZhciB2aWV3ZXJNb2RlID0gd2luZG93LkhUTUxXaWRnZXRzLnZpZXdlck1vZGUgPQogICAgICAvXGJ2aWV3ZXJfcGFuZT0xXGIvLnRlc3Qod2luZG93LmxvY2F0aW9uKTsKCiAgLy8gU2VlIGlmIHdlJ3JlIHJ1bm5pbmcgaW4gU2hpbnkgbW9kZS4gSWYgbm90LCBpdCdzIGEgc3RhdGljIGRvY3VtZW50LgogIC8vIE5vdGUgdGhhdCBzdGF0aWMgd2lkZ2V0cyBjYW4gYXBwZWFyIGluIGJvdGggU2hpbnkgYW5kIHN0YXRpYyBtb2RlcywgYnV0CiAgLy8gb2J2aW91c2x5LCBTaGlueSB3aWRnZXRzIGNhbiBvbmx5IGFwcGVhciBpbiBTaGlueSBhcHBzL2RvY3VtZW50cy4KICB2YXIgc2hpbnlNb2R
@jarvisc1
jarvisc1 / footballcrimes.csv
Last active October 31, 2015 16:30
Crime during Premier league 2013-14 season
team total home away notfan violent disorder missle racist pitchinvasion alcohol touting weapon fireworks banned propertydamage
Arsenal 67 37 28 2 4 30 1 1 3 21 3 0 2 1 1
Aston Villa 36 16 20 0 3 16 0 2 1 8 0 0 6 0 0
Cardiff City 16 1 15 0 4 6 1 0 0 4 0 0 1 0 0
Chelsea 56 31 23 2 12 14 2 0 1 15 6 3 2 1 0
Crystal Palace 19 9 8 2 3 1 1 0 8 5 0 1 0 0 0
Everton 47 8 38 1 1 19 2 0 3 12 2 1 5 0 2
Fulham 24 9 15 0 1 7 1 0 1 5 5 0 2 0 2
Hull City 21 11 10 0 2 10 0 0 0 8 0 0 1 0 0
Liverpool 58 17 39 2 15 14 1 0 4 16 2 0 4 1 1