Skip to content

Instantly share code, notes, and snippets.

View lgatto's full-sized avatar

Laurent Gatto lgatto

View GitHub Profile
@lgatto
lgatto / makeFoIs.R
Last active September 1, 2016 16:09
BHC projections on PCA plot
f <- "clusteringlopit/dunkley/hc_labels_observations_a.txt"
library("pRolocdata")
library("pRoloc")
data(dunkley2006)
makeFoIs <- function(fn, obj) {
x <- readLines(fn)[-1] ## first is 'x'
i <- grep("---", x)
@lgatto
lgatto / updateRdevel.sh
Created May 12, 2016 13:58
R installation scripts
#!/bin/bash
## getting the latest R-devel src
rtgz=R-devel.tar.bz2
rsrc=R-devel
rm $rtgz
wget ftp://ftp.stat.math.ethz.ch/Software/R/$rtgz
rm -rf $rsrc
## installation
@lgatto
lgatto / console.log
Created April 26, 2016 08:20
ImpactStory console log
unreachable code after return statement ti.js:828:12
unreachable code after return statement ti.js:1834:24
unreachable code after return statement ti.js:828:12
person is loading! Object { $id: 1, $$childTail: Object, $$childHead: Object, $$prevSibling: null, $$nextSibling: null, $$watchers: Array[2], $parent: null, $$phase: "$digest", $root: Object, $$destroyed: false, 12 more… } ti.js:923:21
Person Service getting from server: 0000-0002-1520-2268 ti.js:1579:13
Auto-adding the missing md-mode='indeterminate' to the ProgressCircular element angular.min.js:107:210
The resource at "https://www.google-analytics.com/analytics.js" was blocked because tracking protection is enabled.[Learn More] 0000-0002-1520-2268
The resource at "https://widget.intercom.io/widget/z93rnxrs" was blocked because tracking protection is enabled.[Learn More] 0000-0002-1520-2268
retrieved the person Object { _full_name: "Laurent Gatto", _id: "l3twu5batt", affiliation_name: "University of Cambridge", affiliation_role_title: "Senior Researc
@lgatto
lgatto / SC-ICS-announcement.md
Created March 27, 2016 18:55
SC ICS announcement

An R-based instructor training sponsored by the R consortium

The R consortium Infrastructure Steering Committee awards have been officially announced and we are happy to confirm that our proposal to organise an R-based instructor training was successful.

We will organise an in-person instructor training that will focus on R. While the content of the training will not change as such,

@lgatto
lgatto / hyperlopit-tfe.R
Last active February 10, 2016 10:38
Tfe3 and hyperLOPIT plot
## load packages and data
library("pRoloc")
library("pRolocdata")
data(hyperLOPIT2015)
## produce PCA plot
plot2D(hyperLOPIT2015)
addLegend(hyperLOPIT2015, where = "bottomleft", cex = .7)
## Find Tfe3's identifier and define it as a
@lgatto
lgatto / emacs-test.el
Last active January 26, 2016 16:11
emacs-poly-mode-debugging
(setq package-user-dir (expand-file-name "~/fmp"))
(require 'package)
(package-initialize)
(require 'ess-site)
(require 'poly-R)
(require 'poly-markdown)
@lgatto
lgatto / keybase.md
Last active December 30, 2022 18:30

Keybase proof

I hereby claim:

  • I am lgatto on github.
  • I am lgatto (https://keybase.io/lgatto) on keybase.
  • I have a public key whose fingerprint is 3228 0F50 8589 B085 9E3D A828 0C03 2B80 46E2 E38A

To claim this, I am signing this object:

def fib(n):
fib = [0, 1]
while len(fib) < n+1:
fib.append(fib[-2] + fib[-1])
return fib[1:]
@lgatto
lgatto / colour-picker.R
Last active November 7, 2015 13:37
A simple interface to select colours
colour_picker <- function() {
n <- length(colours())
i <- ceiling(sqrt(n))
m <- matrix(c(1:n, rep(NA, i^2 - n)),
ncol = i, nrow = i)
## plotting
image(m, col = colours(),
xaxt = "n", yaxt = "n")
k <- seq(0, 1, length.out = i)
kk <- expand.grid(k, k)
@lgatto
lgatto / curse-of-dimensionality.R
Created April 29, 2015 22:57
Curse of dimensionality
d <- 1:200
N <- 1000
dat <- lapply(d, function(i) replicate(i, runif(N)))
nout <- function(m) mean(apply(m, 1, function(i) any(i < 0.01 | i > 0.99)))
res <- sapply(dat, nout)
plot(res, type = "l",
xlab = "Number of dimensions",