| roptions: | dev='png',highlight=FALSE |
|---|
print(2 + 2)
cat("hello")
| (defun yas/expand-by-uuid (mode uuid) | |
| "Exapnd snippet template in MODE by its UUID" | |
| (yas/expand-snippet | |
| (yas/template-content | |
| (yas/get-template-by-uuid mode uuid)))) | |
| ;; Yasnippet templates used in auto-insert mode | |
| (require 'autoinsert) | |
| (auto-insert-mode) | |
| (setq auto-insert-query nil) |
| %% Note, the definitions of TeX and LaTeX are in texnames.sty file | |
| %% Code from texnames.sty | |
| \ifx\sc\undefined | |
| \def\sc{% | |
| % If there is no \scriptfont for the current family, use a fixed | |
| % font. What more can we do? | |
| \expandafter\ifx\the\scriptfont\fam\nullfont | |
| \font\temp = cmr7 \temp | |
| \else |
| library("Amelia") | |
| library("foreach") | |
| ## or backend of choice | |
| library("doMC") | |
| registerDoMC() | |
| ameliapar <- function(x, m=5, p2s=0, ...) { | |
| impdata <- foreach (i = 1:m, | |
| .combine = "c", | |
| .packages="Amelia") %dopar% { |
| library("proto") | |
| library("mvtnorm") | |
| ##' Gibbs sampler | |
| ##' | |
| ##' General Gibbs sampler object. | |
| ##' | |
| ##' TODO | |
| GibbsSampler <- proto(expr = { |
| \documentclass{article} | |
| \usepackage{tikz} | |
| \begin{document} | |
| \begin{tikzpicture} | |
| \draw[black] (-3,0) -- (4,0); | |
| \draw (-1.5, -0.1) -- (-1.5, 0.1) node[above] {FOOO}; | |
| \foreach \x in {-2,-1,0,1,2,3} | |
| \draw (\x,0) -- (\x,-0.1) node[below] {$\x$}; |
| roptions: | dev='png',highlight=FALSE |
|---|
print(2 + 2)
cat("hello")
| #!/usr/bin/env Rscript | |
| ### Example R script for syntax highlighting | |
| # This is also a comment | |
| ## Valid names | |
| abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV0123456789._a <- NULL | |
| .foo_ <- NULL | |
| ._foo <- NULL |
| // Code generated by Stan version 1.0 | |
| #include <stan/model/model_header.hpp> | |
| namespace foo_namespace { | |
| using std::vector; | |
| using std::string; | |
| using std::stringstream; | |
| using stan::agrad::var; |
| ##' Redefine mcmc as S4 class | |
| setClass("mcmc", contains="matrix", | |
| representation(start="numeric", | |
| end="numeric", | |
| thin="numeric")) | |
| setOldClass("mcmc", S4Class="mcmc") | |
| setClass("mcmc.list", contains="list", | |
| validity = function(object) { | |
| if (length(object@.Data) == 0) { |
| ## Monte Carlo Standard Error | |
| ## @export | |
| setGeneric("mcse", function(x, ...) { | |
| ret <- mcmcse::mcse(x, ...) | |
| ifelse(is.na(ret), c(est=NA, se=NA), unlist(ret)) | |
| }) | |
| setMethod("mcse", "matrix", function(x, ...) { | |
| t(apply(x, 2, mcse, ...)) | |
| }) |