Skip to content

Instantly share code, notes, and snippets.

View kjhealy's full-sized avatar

Kieran Healy kjhealy

View GitHub Profile
library(lattice)
data <- read.csv("cities.csv",header=TRUE,row.names=1)
quartz()
stripplot(log(data$Population),groups=data$Outcome)
dev.off()
pdf(file="cities.pdf",height=8,width=8)
dotchart(log(data$Population), groups=data$Outcome,xlab="log Population")
dev.off()
;; ESS: Emacs Speaks Statistics
(load "~/elisp/vendor/ess/lisp/ess-site.el")
;; Use shift-enter to split window & launch R (if not running), execute highlighted
;; region (if R running & area highlighted), or execute current line
;; (and move to next line, skipping comments). Nice.
;; See http://www.emacswiki.org/emacs/EmacsSpeaksStatistics,
;; FelipeCsaszar. Adapted to spilit vertically instead of
;; horizontally.
This is BibTeX, Version 0.99c (TeX Live 2009)
The top-level auxiliary file: organizations.aux
The style file: biblatex.bst
I couldn't open database file organizations-blx.bib
---line 4 of file organizations.aux
: \bibdata{organizations-blx
: ,socbib}
I'm skipping whatever remains of this command
I found no database files---while reading file organizations.aux
;; Via http://blogisticreflections.wordpress.com/2009/10/01/r-object-tooltips-in-ess/
;;
;; ess-R-object-tooltip.el
;;
;; I have defined a function, ess-R-object-tooltip, that when
;; invoked, will return a tooltip with some information about
;; the object at point. The information returned is
;; determined by which R function is called. This is controlled
;; by an alist, called ess-R-object-tooltip-alist. The default is
;; given below. The keys are the classes of R object that will
### Following up on
### http://codeandculture.wordpress.com/2010/02/28/more-r-headaches
library(igraph)
library(plyr) # Hadley Wickham FTW, as usual
## ----------------------------------------------------------------------
## NB for file reading and writing below, we're assuming figures/ and
## data/ subdirs exist in the working directory. Change paths as
## appropriate.
@kjhealy
kjhealy / my-auto-tex-cmd.el
Created January 21, 2011 14:14
Use latexmk to manage pdf export in orgmode, choosing latex/pdflatex/xelatex as needed
(require 'org-latex)
(setq org-export-latex-listings t)
;; Originally taken from Bruno Tavernier: http://thread.gmane.org/gmane.emacs.orgmode/31150/focus=31432
;; but adapted to use latexmk 4.20 or higher.
(defun my-auto-tex-cmd ()
"When exporting from .org with latex, automatically run latex,
pdflatex, or xelatex as appropriate, using latexmk."
(let ((texcmd)))
;; default command: oldstyle latex via dvi
@kjhealy
kjhealy / sample-xetex
Created January 25, 2011 16:03
Sample header for org-mode file to be processed with xelatex
#+TITLE: My Paper
#+AUTHOR: Jane Doe
#+DATE: January, 2011
#+OPTIONS: toc:nil num:nil
#+LATEX_CMD: xelatex
#+LATEX_HEADER: \setsansfont[Mapping=tex-text, BoldFont={Unit-Bold}, ItalicFont={Unit-Regular}]{Unit-Bold}
#+LATEX_HEADER: \setmonofont[Mapping=tex-text,Scale=MatchLowercase]{PragmataPro}
#+LATEX_HEADER: \setromanfont[Mapping=tex-text,Numbers=OldStyle]{Charis SIL}
** Introduction
@kjhealy
kjhealy / xelatex-minted.el
Created February 3, 2011 14:12
Current xelatex + minted + latexmk setup
(require 'org-latex)
;; Choose either listings or minted for exporting source code blocks.
;; Using minted (as here) requires pygments be installed. To use the
;; default listings package instead, use
;; (setq org-export-latex-listings t)
;; and change references to "minted" below to "listings"
(setq org-export-latex-listings 'minted)
;; Originally taken from Bruno Tavernier: http://thread.gmane.org/gmane.emacs.orgmode/31150/focus=31432
;; but adapted to use latexmk 4.22 or higher.
@kjhealy
kjhealy / polar-labels.r
Created February 19, 2011 02:34
Align labels nicely in circular igraph plots
### Here's one way to do it.
library(igraph)
library(ggplot2)
## The igraph docs say that vertex.label.degree controls the position
## of the labels with respect to the vertices. It's interpreted as a
## radian, like this:
##
## Value is : Label appears ... the node
@kjhealy
kjhealy / Jekyll Liquid tag for MathJax.rb
Created September 26, 2011 14:00 — forked from jessykate/Jekyll nd Octopress Liquid tag for MathJax.rb
A simple liquid tag for Jekyll that converts {% m %} and {% em %} into inline math, and {% math %} and {% endmath %} into block equations, by replacing with the appropriate MathJax script tags.
module Jekyll
class MathJaxBlockTag < Liquid::Tag
def render(context)
'<script type="math/tex; mode=display">'
end
end
class MathJaxInlineTag < Liquid::Tag
def render(context)
'<script type="math/tex">'
end