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
options(error = function() { | |
library(RPushbullet) | |
pbPost("note", "Error", geterrmessage()) | |
if(!interactive()) stop(geterrmessage()) | |
}) | |
stop("this is an error") | |
message("Shouldn't get here") |
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
myscript.js: myscript.coffee | |
coffee -bc $< |
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
myscript.js: myscript.coffee | |
coffee -bc $< |
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
myscript.js: myscript.coffee | |
coffee -bc $< |
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
# empty file with initial underscore, to give the gist a better name |
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 laundry contains n_pair pairs of socks and n_sing singletons, | |
# how many socks to draw to get first pair? | |
sim_socks <- | |
function(n_pair=21, n_sing=3, n_sim=100000) | |
{ | |
socks <- c(rep(1:n_pair, 2), n_pair+(1:n_sing)) | |
# replicate(n_sim, min(which(duplicated(sample(socks))))) | |
library(magrittr) |
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
# convert c("female", "Male") to c(0,1) | |
# magrittr is way nicer than nested function calls | |
convert_sexcodes <- | |
function(codes) | |
{ | |
require(magrittr) | |
tolower(codes) %>% |
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
options(show.signif.stars=FALSE, scipen=10, htmlhelp=TRUE) | |
options(width=115, repos="http://cran.rstudio.com", | |
CRAN = "http://cran.rstudio.com", | |
browserNLdisabled = TRUE, | |
deparse.max.lines = 2) | |
if (interactive()) { | |
suppressMessages(require(devtools)) | |
} | |
options(error= function() cat(" \\\ \n \\\ |
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
A regular code chunk: | |
```{r regular} | |
data(cars) | |
summary(cars) | |
``` | |
A verbatim code chunk: |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<feed xmlns="http://www.w3.org/2005/Atom"> | |
<link | |
href="http://arxiv.org/api/query?search_query%3Dti%3Adeconvolution%20AND%20submittedDate%3A%5B199001010000%20TO%20201409062400%5D%26id_list%3D%26start%3D0%26max_results%3D2" | |
rel="self" type="application/atom+xml"/> | |
<title type="html">ArXiv Query: search_query=ti:deconvolution AND | |
submittedDate:[199001010000 TO | |
201409062400]&id_list=&start=0&max_results=2</title> | |
<id>http://arxiv.org/api/PmrTD7mnJhK1VVvONMZIkrVVdAg</id> | |
<updated>2014-09-09T00:00:00-04:00</updated> |