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
/* collect a one-off keyboard response, using JQuery namespaces to allow multiple, overlapping responses | |
* fcn(e): function to be called with event on key press | |
* keys: vector of allowed keys (as characters, uppercase for alphanumeric) (optional) | |
* to: timeout for response, in ms (optinal) | |
* tofcn: function to be called on timeout (optional) | |
*/ | |
function collect_keyboard_resp(fcn, keys, to, tofcn) { | |
// create unique namespace for this response | |
var namespace = '._resp' + (new Date()).getTime(); |
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
require(plyr) | |
require(ggplot2) | |
# say dat is a data.frame with the predictor x, grouping variables z1, z2, and z3 (factors or discrete numeric values) | |
# and the observed values are in the variable y. then I would do: | |
dat.summ <- ddply(dat, .(x, z1, z2, z3), summarise, | |
y.mean=mean(y), y.se=sd(y)/sqrt(length(y))) | |
# this is equivalent to |
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
#!/bin/bash | |
# knit.sh -- Dave Kleinschmidt, April 2013 | |
# streamline knitting of Rnw files from the command line. | |
usage="Usage: $0 input-filename.Rnw [-nolatex] [-notangle]" | |
if [ $# -lt 1 ]; then | |
echo $usage | |
exit 1 | |
fi |
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
mod.to.table <- function(mod.all=NA, prednames=NA, pred_name_subs=NA, file="", | |
coefs=as.data.frame(summary(mod.all)@coefs), | |
...) { | |
if (is.na(prednames)) { | |
if (is.na(pred_name_subs)) { | |
prednames <- row.names(coefs) | |
} else { | |
prednames <- str_replace_multi(row.names(coefs), pred_name_subs, replace.all=T) | |
} | |
} |
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
#!/bin/bash | |
# Author: Dave Kleinschmidt | |
# | |
#!/bin/bash | |
# Author: Dave Kleinschmidt | |
# | |
# concatenate all *.results files in the directory, printing one line | |
# per unique assignment id (first encountered). NOTE: the header isn't |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>auto-clean-mendeley-library</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/Users/dkleinschmidt/Documents/papers/clean-library-auto.sh</string> | |
</array> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
using Stats, Distributions, Gadfly | |
import Gadfly.ElementOrFunction | |
# First add a method to the basic Gadfly.plot function for QQPair types (generated by Distributions.qqbuild()) | |
Gadfly.plot(qq::QQPair, elements::ElementOrFunction...) = Gadfly.plot(x=qq.qx, y=qq.qy, Geom.point, Theme(highlight_width=0px), elements...) | |
# Now some shorthand functions | |
qqplot(x, y, elements::ElementOrFunction...) = Gadfly.plot(qqbuild(x, y), elements...) | |
qqnorm(x, elements::ElementOrFunction...) = qqplot(Normal(), x, Guide.xlabel("Theoretical Normal quantiles"), Guide.ylabel("Observed quantiles"), elements...) |
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
{ | |
"accessKey": "your access key", | |
"secretKey": "your secret key" | |
} |
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
library(dplyr) | |
data.frame(a=factor(c('10', '20', '30', '40'))) %>% | |
mutate(b=as.character(a)) %>% | |
rowwise() %>% | |
mutate(c=as.character(a)) %>% | |
str |
OlderNewer