Skip to content

Instantly share code, notes, and snippets.

@dougmet
dougmet / Visual Studio Dark.rstheme
Last active May 6, 2020 20:35
An RStudio Theme File matching VS Code
/* rs-theme-name: Visual Studio Dark */
/* rs-theme-is-dark: TRUE */
/* THIS THEME WAS AUTOGENERATED BY Theme.tmpl.css (UUID: 2fd1a8f9-ddfd-11e2-a28f-0800200c9a66) */
.ace_gutter {
background: #1E1E1E;
color: #7D7D7D;
}
.ace_print-margin {
# This is saving a task I have every now and then to download a list of packages, and
# their dependencies, so that I can manually copy them somewhere.
# Date and R version should probably be parameterised
options("repos" = "https://mran.microsoft.com/snapshot/2018-01-01") # modern
stopifnot(R.version$minor == "4.3")
#' Get package dependencies
#'
{ "dimensions": {
"Subject": ["S1","S2","S3","S4","S5","S6","S7","S8"],
"Channel": ["X", "Y", "Z"],
"Time": [0,1,2,3,4,5,6,7,8,9]
},
"data": [
[
[34, 23, 30, 32, 18, 40, 29, 39],
[23, 29, 29, 29, 35, 33, 15, 24],
[41, 43, 43, 32, 31, 25, 26, 41]
@dougmet
dougmet / reporting.json
Created March 7, 2019 11:51
Example of reporting json
{
"statuses": [
{
"value": "complete",
"translation_key": "status.reported_online"
},
{
"value": "notstarted",
"translation_key": "status.exploring_data_sources"
}
library(Rcpp)
library(purrr)
library(microbenchmark)
# Build a fairly big data frame with empty totals (except the first one)
# and daily interest rates
n <- 10000
t0 <- 100.0
daily <- data.frame(total = c(t0, rep(NA_real_, n-1)),
{
"overall": {
"statuses": {
"complete": 164,
"nontstarted": 77
},
"totals": {
"applicable": 241,
"count": 244
}

Keybase proof

I hereby claim:

  • I am dougmet on github.
  • I am dougashton (https://keybase.io/dougashton) on keybase.
  • I have a public key ASD9WhG2KPW9cMEeEjByeRDX-KGDOwNTikLdnJ_aLeMGGgo

To claim this, I am signing this object:

---
title: "Analysing the Twitter Mentions Network"
author: "Douglas Ashton"
date: "Thursday, February 05, 2015"
output: html_document
---
```{r functions, echo=FALSE}
library(knitr)
---
title: "Predicting the six nations"
author: "Douglas Ashton"
output:
html_document:
css: rugby.css
---
I don't know a lot about rugby, which can be a problem living in a [rugby town](http://en.wikipedia.org/wiki/Bath_Rugby). Especially when the office sweep stake on the upcoming Wales vs England six nations game goes round: apparently 2-1 is not a valid rugby score. I'm not about to put a pound down without some research. Fortunately England and Wales have played each other before:
library(httr)
library(magrittr)
library(dplyr)
library(ggplot2)
# data retrieval ----------------------------------------------------------
pg <- GET("http://data.giss.nasa.gov/gistemp/tabledata_v3/GLB.Ts+dSST.txt",
user_agent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A"))