This file contains hidden or 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
### delete tex files in slides folder | |
cd ~/Documents/Teaching/SRQM/Course | |
rm *.aux *.dvi *.toc *.log *.nav *.out *.snm *.synctex.gz *.tex.bak *.vrb *.run.xml *-blx.bib *.idx *.fdb_latexmk | |
### delete log files in replication folder | |
cd ~/Documents/Teaching/SRQM/Replication/ |
This file contains hidden or 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
/* | |
Styling for Markdown preview in TextMate, copty to: | |
~/Library/Application Support/TextMate/Managed/Bundles/Themes.tmbundle/Support/web-themes/SRQM/style.css | |
*/ | |
@import url(http://fonts.googleapis.com/css?family=Ubuntu:400,500,400italic); | |
@import url(http://fonts.googleapis.com/css?family=Ubuntu+Mono); | |
*, p { | |
font-family: "Ubuntu", sans-serif; |
This file contains hidden or 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
lookfor <- function(data, | |
keywords = "weight|sample", | |
labels = TRUE, | |
ignore.case = TRUE) { | |
# search scope | |
n <- names(data) | |
if(!length(n)) stop("there are no names to search in that object") | |
# search function | |
look <- function(x) { grep(paste(keywords, collapse="|"), x, ignore.case = ignore.case) } | |
# names search |
This file contains hidden or 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
# ggplot2 map themes by Osmo Saloma | |
theme_map = function(base_size=9, base_family="") | |
{ | |
require(grid) | |
theme_osa(base_size=base_size, base_family=base_family) %+replace% | |
theme(axis.line=element_blank(), | |
axis.text.x=element_blank(), | |
axis.text.y=element_blank(), | |
axis.ticks=element_blank(), |
This file contains hidden or 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
# Chris Giles: | |
# | |
# "Robustness of IMF data scrutinised", Oct 12 2012: | |
# http://www.ft.com/intl/cms/s/0/85a0c6c2-1476-11e2-8cf2-00144feabdc0.html#axzz2LKQkV3SH | |
# | |
# "Has the IMF proved multipliers are really large? (wonkish)" Oct 12 2012: | |
# http://blogs.ft.com/money-supply/2012/10/12/has-the-imf-proved-multipliers-are-really-large-wonkish/ | |
# | |
# "The IMF and multipliers, again", Jan 7 2013: | |
# http://blogs.ft.com/money-supply/2013/01/07/the-imf-and-multipliers-again/ |
This file contains hidden or 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
*! 0.2.3 F. Briatte 20mar2013 | |
cap pr drop svyplot | |
program svyplot | |
syntax varlist(max=3) [if] [in] [aweight fweight iweight/] /// | |
[, Reds Blues Ascending Descending Horizontal Ymax(int 100) /// | |
Float(int 0) Size(real 3.5) ANGLE(int 0) NOPercent XLAb *] | |
// parse options |
This file contains hidden or 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 data/qog2011, clear | |
// religious populations | |
d lp_*80 | |
local vars = "lp_catho80 lp_muslim80 lp_protmg80 lp_no_cpm80" | |
// kernel densities | |
local plot = "" |
This file contains hidden or 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
#' If you like [this approach][1] to correlation matrixes, you might also like | |
#' the `arm::corrplot` function. Here's a ggplot2 implementation. | |
#' [1]: http://stackoverflow.com/questions/12196756/significance-level-added-to-matrix-correlation-heatmap-using-ggplot2 | |
ggcorr <- function(x, method = "pairwise", palette = "RdYlGn") { | |
require(ggplot2) | |
require(reshape) # edit when reshape2 reaches maturity | |
M <- cor(x[1:ncol(x)], use = method) | |
M <- M * lower.tri(M) |
This file contains hidden or 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
findCreditCards <- function() { | |
pattern <- "([0-9]{4}[- ]){3}[0-9]{4}" | |
path <- "~/Documents" | |
filelist <- list.files(path, full.names=TRUE, recursive=TRUE) | |
for (filename in filelist){ | |
if(file.info(filename)$size > 1e6) next | |
doc <- readLines(filename) | |
results <- gregexpr(pattern, doc) | |
output <- unlist(regmatches(doc, results)) | |
if(length(output) > 0){ |
This file contains hidden or 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
structure(list(Year = c(1917L, 1918L, 1919L, 1920L, 1921L, 1922L, | |
1923L, 1924L, 1925L, 1926L, 1927L, 1928L, 1929L, 1930L, 1931L, | |
1932L, 1933L, 1934L, 1935L, 1936L, 1937L, 1938L, 1939L, 1940L, | |
1941L, 1942L, 1943L, 1944L, 1945L, 1946L, 1947L, 1948L, 1949L, | |
1950L, 1951L, 1952L, 1953L, 1954L, 1955L, 1956L, 1957L, 1958L, | |
1959L, 1960L, 1961L, 1962L, 1963L, 1964L, 1965L, 1966L, 1967L, | |
1968L, 1969L, 1970L, 1971L, 1972L, 1973L, 1974L, 1975L, 1976L, | |
1977L, 1978L, 1979L, 1980L, 1981L, 1982L, 1983L, 1984L, 1985L, | |
1986L, 1987L, 1988L, 1989L, 1990L, 1991L, 1992L, 1993L, 1994L, | |
1995L, 1996L, 1997L, 1998L, 1999L, 2000L, 2001L, 2002L, 2003L, |
OlderNewer