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
convid <- function(ID) { | |
# function to convert cantonal ID, v.1.0 (12 Nov 2013) didier.ruedin@wolfson.oxon.org | |
clabels <- c("ZH", "BE", "LU", "UR", "SZ", "OW", "NW", "GL", "ZG", "FR", "SO", "BS","BL", "SH", "AR", "AI", "SG", "GR", "AG", "TG", "TI", "VD", "VS", "NE", "GE", "JU") | |
id <- ifelse(is.numeric(ID), clabels[ID], match(ID, clabels)) | |
return(id) | |
} | |
plzvalid <- function(PLZ) { | |
# check if a number is a valid postcode; v.1.1 (1 Feb 2013) didier.ruedin@wolfson.oxon.org | |
return(!is.na(plzcanton(PLZ))) |
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
Attribute VB_Name = "Module1" | |
Sub SplitNotes(delim As String, strFilename As String) | |
Dim doc As Document | |
Dim arrNotes | |
Dim I As Long | |
Dim X As Long | |
Dim Response As Integer | |
arrNotes = Split(ActiveDocument.Range, delim) | |
Response = MsgBox("This will split the document into " & UBound(arrNotes) + 1 & " sections. Do you wish to proceed?", 4) | |
If Response = 7 Then Exit Sub |
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(denstrip) | |
fade <- function(x, labels=names(coef(x)), expo=FALSE, xlab="", ylab="", bty="n", ...) { | |
# argument: a regression, additional arguments passed on to plot() and text() | |
coe <- summary(x)$coefficients[,1] # extract coefficients | |
cse <- summary(x)$coefficients[,2] # standard errors | |
len <- length(coe) # how many coefficients (without intercept) | |
if(expo == TRUE) { # exponential form | |
coe <- exp(coe) | |
cse <- exp(cse) | |
} |
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
die | |
und | |
der | |
in | |
zu | |
für | |
mit | |
ist | |
sich | |
den |
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
# Code by Matt Asher for statisticsblog.com | |
# Feel free to modify and redistribute | |
# How many flakes do you want to fall? | |
flakes = 100 | |
# Width and height of your space |
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(agrmt) # install from R-Forge | |
# Data: | |
V <- c(0,0,1,2,1.5,1.6) | |
# AJUS | |
ajus(V) # using default tolerance = 0.1 | |
ajusPlot(V) # visual inspection | |
ajus(V, tolerance=0.2) # exploring | |
ajusCheck(V, t=seq(0.1,2,0.1)) # let's try them all |
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
miss <- !is.na(variable.name[country=="UK") | |
plot(which(miss), variable.name[country=="UK" & miss], col="red", type="b", lwd=2, axes=FALSE, xlim=c(1,16)) | |
axis(2) | |
axis(1,at=c(1,6,11,16), labels=c("1995","2000","2005","2010")) |
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
as_pdf <- function(x){ | |
require(tools) | |
fname <- tempfile(pattern = "texview-", tmpdir = tempdir(), | |
fileext = ".tex") | |
header <- "\\documentclass{article} | |
\\usepackage[margin=10pt,font=small,labelformat=empty, | |
labelsep=none]{caption} | |
\\usepackage{dcolumn} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" page-range-format="chicago" demote-non-dropping-particle="sort-only"> | |
<info> | |
<title>Ethnic and Racial Studies</title> | |
<id>http://www.zotero.org/styles/ethnic-and-racial-studies</id> | |
<link href="http://www.zotero.org/styles/ethnic-and-racial-studies" rel="self"/> | |
<link href="www.tandfonline.com/action/authorSubmission?journalCode=rers20&page=instructions" rel="documentation"/> | |
<author> | |
<name>Didier Ruedin</name> | |
<email>didier.ruedin@wolfson.oxon.org</email> |
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
namav <- function(x,k=3){ | |
x <- c(rep(NA, k),x,rep(NA,k)) # add NA on both sides | |
n <- length(x) | |
return(sapply((k+1):(n-k), function(i) sum(x[(i-k):(i+k)],na.rm=TRUE)/(2*k+1-sum(is.na(x[(i-k):(i+k)]))))) | |
} |
OlderNewer