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
snippet for | |
for (${1:var} in ${2:start}:${3:end}) { | |
${0} | |
} | |
snippet if | |
if (${1:condition}) { | |
${0} | |
} |
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
eng_printfile <- function(options) { | |
code <- paste(readLines(options$engine.opts$file), collapse = "\n") | |
options$engine <- options$engine.opts$lang | |
knitr::engine_output(options, code, '') | |
} | |
knitr::knit_engines$set(printfile = eng_printfile) |
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
list_of_stuff <- | |
list(a = rnorm(100), | |
b = rnorm(100)) | |
with(list_of_stuff, plot(a, b)) |
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
#' CS&SS/SOC/STAT 221 Install Script | |
#' | |
#' Install R Commander and necessary packages and data to be | |
#' used in CS&SS/SOC/STAT 221. | |
#' | |
is_installed <- function(pkg) { | |
is.element(pkg, installed.packages()[,1]) | |
} |
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
intall.packages("devtools") | |
devtools::install_github(c("jrnold/bps5data", "jrnold/bps6data")) |
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
# Treebank Tokenizer in R | |
# | |
# Code is a port of the NLTK python and sed scripts: | |
# - http://www.nltk.org/_modules/nltk/tokenize/treebank.html#TreebankWordTokenizer | |
# - http://www.cis.upenn.edu/~treebank/tokenizer.sed | |
library("stringr") | |
library("tokenizers") | |
library("microbenchmark") | |
.CONTRACTIONS2 <- |
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
// Local Level model in Stan | |
// parameterized using Matt's Trick | |
data { | |
int n; | |
vector[n] y; | |
real<lower=0> theta1_mean; | |
real<lower=0> theta1_sd; | |
} | |
parameters { | |
real<lower=0> sigma_v; |
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
/* | |
A file for testing Stan syntax highlighting. | |
It is not a real model and will not compile | |
*/ | |
# also a comment | |
// also a comment | |
functions { | |
void f1(void a, real b) { | |
return 1 / a; |
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
define(function(require, exports, module) { | |
var oop = require("../lib/oop"); | |
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; | |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | |
var StanHighlightRules = function() { | |
var keywords = ( |