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
# add remote | |
git remote add <name> <url> | |
# fetch and merge | |
git fetch <name> | |
git merge <name> | |
# see also: https://help.github.com/articles/syncing-a-fork/ |
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
# | |
# Compare lmer and inla for LMM | |
# largely taken from Spatial and spatio-temporal bayesian models with R-INLA (Blangiardo & Cameletti, 2015), section 5.4.2 | |
# | |
m <- 10000 # N obs | |
set.seed(1234) | |
x <- rnorm(m) | |
group <- sample(seq(1, 100), size = m, replace = 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
# Download data | |
token <- readLines("PATH/TO/TOKEN") | |
library(httr) | |
url <- "PATH/TO/API" | |
# data itself | |
x <- POST(url, | |
config = httr::config(SSL_VERIFYPEER = FALSE), | |
body = list(token = token, | |
content = "record", type = "flat", | |
format = "csv")) |
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(osmdata) | |
library(rgdal) ; library(maptools) ; library(rgeos) | |
q0 <- opq(bbox = "Bern, Switzerland", timeout = 60) | |
q1 <- add_osm_feature(q0, key = 'building', value = "hospital") | |
x <- osmdata_sp(q1) | |
library(leaflet) |
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(sp) | |
# create polygons | |
p1 <- matrix(c(1,1, | |
2,1, | |
4,2, | |
3,2), ncol = 2, byrow = TRUE) | |
p2 <- matrix(c(2.2,1, | |
3,1, | |
3,2, |
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
#==========================================================# | |
# Visualizing Facebook networks with friend photos # | |
# Katya Ognyanova, www.kateto.net, @ognyanova # | |
#==========================================================# | |
# Find more details at http://bit.ly/fbgephi | |
#==========================================================# | |
#### Collect the data using the RFacebook package #### |
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
passgen <- function(n = 8){ | |
chars <- c(LETTERS, letters, as.character(seq(0,9,1)), "!", "$", ".", "_", "-", "?") | |
paste0(sample(chars, n), collapse = "") | |
} | |
passgen() |
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
colsearch <- function(data, query, ignore.case=TRUE){ | |
n <- ncol(data) | |
c <- character(0) | |
for(i in 1:n){ | |
if(TRUE %in% grepl(query, unique(data[,i]), ignore.case=ignore.case)) c <- c(c, names(data)[i]) | |
} | |
c | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |