Skip to content

Instantly share code, notes, and snippets.

@jeromyanglim
jeromyanglim / CollapseHeadings.bas
Created December 14, 2012 07:25
Simple VBA script that I use in Mac Word for collapsing Up headings in Outline View; it works for me, but I've had it floating around for so long, I barely remember how it works.
Sub CollapseHeadings()
' Use this code at your own risk
' It works for me. I use it in Word documents while in Outline View
' for documents set up with Outline View in mind
' Remember Ctrl + Pause Break will get break the program
On Error GoTo ErrorHandler
Dim r As Range, o As Integer, p As Long, f As Boolean
Dim currentOutlineLevel, nextOutlineLevel
Dim timeout As Integer ' used to pre
@jeromyanglim
jeromyanglim / keys.css
Created October 25, 2012 11:42
keys css
kbd{white-space:nowrap;
color:#000;
background:#eee;
border-style:solid;
border-color:#ccc #aaa #888 #bbb;
padding:2px 6px;
-moz-border-radius:4px;
-webkit-border-radius:4px;
border-radius:4px;
-moz-box-shadow:0 2px 0 rgba(0, 0, 0, 0.2),0 0 0 1px #ffffff inset;
@jeromyanglim
jeromyanglim / rstudio-markdown-error.rmd
Created June 14, 2012 00:52
r markdown error in rstudio
* asdf
```{r}
'asdf'
```
@jeromyanglim
jeromyanglim / bibmash
Created June 10, 2012 11:37
script for extracting apa; I might write a post at some point about how it all works. it's mainly a personal script; it's very raw; use at own risk
#!/bin/bash
bibtexstylefile=apalike
bibtexdatabase=$BIB
pdfdirectory=$BIBDIR
pdfprogram=evince
pandocoutputformat=plain
# returntask
# bibtex : return bibtex record (default)
# format : return
This document is just a test of RPubs platform for publishing R Markdown. I'll use the `survey` dataset from the `MASS` package to explore a few features.
```{r get_data, message=FALSE}
library(MASS)
library(psych)
library(Hmisc)
library(xtable)
data(survey)
```
@jeromyanglim
jeromyanglim / loopsrmarkdown.html
Created May 22, 2012 23:45
example of loops and plots in R Markdown
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<base target="_blank"/>
@jeromyanglim
jeromyanglim / r-markdown-example.html
Created May 21, 2012 07:56
file produced by R Markdown example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
`r opts_chunk$set(cache=TRUE)`
This is a quick set of analyses of the California Test Score dataset. The post was produced using R Markdown in RStudio 0.96. The main purpose of this post is to provide a case study of using R Markdown to prepare a quick reproducible report. It provides examples of using plots, output, in-line R code, and markdown. The post is designed to be read along side the R Markdown source code, which is available as a gist on github.
<!-- more -->
### Preliminaries
* This post builds on my earlier post which provided a guide for [Getting Started with R Markdown, knitr, and RStudio 0.96](jeromyanglim.blogspot.com/2012/05/getting-started-with-r-markdown-knitr.html)
* The dataset analysed comes from the `AER` package which is an accompaniment to the book [Applied Econometrics with R](http://www.amazon.com/Applied-Econometrics-R-Use/dp/0387773169) written by [Christian Kleiber](http://wwz.unibas.ch/personen/profil/person/kleiber/) and [Achim Zeileis](http://eeecon.uibk.ac.at/~zeileis/
@jeromyanglim
jeromyanglim / abilitytests.exp
Created May 11, 2012 05:56
Simple, 2-choice, and 4-choice reaction time experiment using Inquisit
<expt ability>
/preinstructions = (initial.instructions)
/blocks=[1=pm.simple; 2=pm.4choice; 3=ac.test.type]
</expt>
<data>
/columns=[date, time, build, subject, trialcode, blockcode, blocknum, trialnum, latency, response, pretrialpause,
posttrialpause, trialtimeout, blocktimeout, correct, stimulusitem, stimulusnumber,
display.height, display.width,
computer.cpuspeed, computer.os,
6162.178176 0.049820046
4675.14432 0.145022261
5969.056896 0.47210138
5357.506176 0.052263122
33.796224 16.45154204
6162.178176 0.064262991
6725.448576 0.419005508
3247.656192 0.867394771
5357.506176 0.052263122
3612.97728 0.091337414