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
## | |
{ | |
## let's go ahead and generate the possibilities. | |
x <- 2 | |
y <- pi | |
z <- exp(1) | |
`%^%` <- `^` | |
`%/%` <- `/` |
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
#.bash_profile | |
TIMEOUT=10 | |
function speak_if_long { | |
last_command_time=$(HISTTIMEFORMAT="%s " history 1 | awk '{print $2}') | |
if (( $(date -u +"%s") - $last_command_time > $TIMEOUT )) | |
then | |
say "I'm done" | |
fi | |
} |
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
# User facing function | |
# | |
# to_math(x_1 + 1^{2 + 4} + 5 + sqrt(y) / 5 %/% 10) | |
# to_math(paste(x^2, y - 1, z_i)) | |
# to_math(hat(tilde(ring(x)))) | |
# to_math(pi*r^2) | |
# to_math(unknown_call(x, floor(sqrt(z)))) | |
to_math <- function(x) { | |
x <- substitute(x) | |
env <- latex_env(x) |
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
library(ggplot2) | |
library(plyr) | |
theme_set(theme_bw()) | |
theme_update(panel.border=element_blank()) | |
# A reaction time experiment works as follows: On each trial, an | |
# observer is asked to view a stimulus and categorize it into one of | |
# multiple values. For instance, it may be a noisy motion stimulus, | |
# and the observer is asked to classify the motion as "leftward" or |
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
library(plyr) | |
library(ggplot2) | |
library(R.cache) | |
library(rstan) | |
#There is a sensor which either emits "yes" or "no." It adds up | |
#signals over some region of space (The "receptive field", which we | |
#model as having a Gaussian profile,) and emits a "yes" if the | |
#summed-up spatially weighted signals, plus unit additive noise, are | |
#over some threshold. |
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
## Performance tuning `rbind.fill` | |
```{r setup, include=FALSE, cache=FALSE} | |
library(methods) | |
opts_chunk$set(cache=TRUE, dev="svg", tidy=FALSE, | |
fig.width=5, fig.height=5, autodep=TRUE, | |
fig.path='figure-') | |
with_dir <- function(dir, expr) { | |
prev <- getwd() | |
setwd(dir) |
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
# lazy data frame | |
# | |
# like idata.frame, but exploits lazy evaluation + macro code generation | |
# instead of active bindings | |
library(vadr) | |
lazy.frame <- function(df, enclos=parent.frame(), ...) UseMethod("lazy.frame") | |
lazy.frame.lazy.frame <- function(df, ...) df |
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
Making install in m4 | |
make[2]: Nothing to be done for `install-exec-am'. | |
make[2]: Nothing to be done for `install-data-am'. | |
Making install in po | |
if test "libextractor" = "gettext-tools"; then \ | |
.././install-sh -c -d /usr/local/Cellar/libextractor/1.0.1/share/gettext/po; \ | |
for file in Makefile.in.in remove-potcdate.sin quot.sed boldquot.sed [email protected] [email protected] insert-header.sin Rules-quot Makevars.template; do \ | |
/usr/bin/install -c -m 644 ./$file \ | |
/usr/local/Cellar/libextractor/1.0.1/share/gettext/po/$file; \ | |
done; \ |
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
SEXP _find_subst_expressions_list(SEXP strs, SEXP begin, SEXP end) { | |
int ns, nb, ne; | |
assert_type(strs, STRSXP); | |
assert_type(begin, STRSXP); | |
assert_type(end, STRSXP); | |
ns = LENGTH(strs); | |
nb = LENGTH(begin); | |
ne = LENGTH(end); | |
int nout; |
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
(require 'ess-site) | |
(require 'ess-rutils) | |
(setq ess-use-tracebug t) | |
(setq ess-dbg-auto-single-key-p nil) | |
(setq inferior-R-args "--no-save") | |
(setq TeX-auto-save t) | |
(setq TeX-auto-parse-self t) |