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(JJHmisc) | |
library(oDeskTools) #internal package for working with oDesk data | |
library(ggplot2) | |
library(reshape2) | |
library(scales) | |
connectDB(get_credentials()) | |
df.wide <- dbGetQuery(con, "select * from active_window_trends") |
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
<html lang="en"> | |
<title>Obot</title> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta name="description" content=""> | |
<meta name="author" content=""> |
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(ggplot2) | |
# simulate experiments using stratification and randomization and report | |
# absolute difference in estimates from true treatment effect, tau. | |
simExp <- function(n, tau, beta = 3){ | |
x <- sort(runif(n)) | |
W.rand <- rbinom(n,1,0.5) | |
W.strat <- rep(c(0,1), n/2) | |
epsilon <- rnorm(n, 0, 0.5) |
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
ts := $(shell /bin/date "+%Y-%m-%d---%H-%M-%S") | |
project.pdf: project.bib project.tex | |
pdflatex -interaction=nonstopmode project | |
bibtex project | |
pdflatex -interaction=nonstopmode project | |
pdflatex -interaction=nonstopmode project | |
backup: | |
tar --exclude='../backups' -zcvf ../backups/project_$(ts).tar.gz ../ |
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
# from: http://learnr.wordpress.com/2010/01/21/ggplot2-crayola-crayon-colours/ | |
library(XML) | |
library(ggplot2) | |
theurl <- "http://en.wikipedia.org/wiki/List_of_Crayola_crayon_colors" | |
html <- htmlParse(theurl) | |
sched <- readHTMLTable(html, stringsAsFactors = FALSE) | |
crayola <- readHTMLTable(html, stringsAsFactors = FALSE)[[2]] | |
crayola <- crayola[, c("Hex Code", "Issued", "Retired")] | |
names(crayola) <- c("colour", "issued", "retired") |
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
entity.write <- function(x){ | |
out = as.character(x) | |
out = paste("\"", x, "\"", sep="") | |
out | |
} | |
toJSONdf <- function(x){ | |
str = "[" | |
for(row in 1:(dim(x)[1])){ | |
first_entry = TRUE |
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(ggplot2) | |
library(reldist) | |
data <- read.csv("User_3144_workers.csv") | |
u = dim(data)[1] | |
png("mturk_distro.png") | |
qplot(Number.of.HITs.approved.or.rejected, data = data) + scale_x_log2() + | |
xlab("Number of HITs Approved or Rejected \n (John Horton's Account)") + | |
ylab("Count of MTurk Workers") + |
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
<script src="http://code.jquery.com/jquery-1.4.4.js"></script> <script> | |
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?", | |
{ | |
tags: "cat", | |
tagmode: "any", | |
format: "json" | |
}, | |
function(data) { | |
$.each(data.items, function(i,item){ | |
$("<img/>").attr("src", item.media.m).appendTo("#images"); |
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
accept_time <- sapply(results$AcceptTime, | |
function(t){as.numeric(as.POSIXct(as.character(t), "%a %b %d %H:%M:%S GMT %Y", tz="UTC"))} | |
) |
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
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"></script> | |
<p><style type="text/css"> | |
/* | |
* jQuery UI CSS Framework 1.8.6 | |
* | |
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) | |
* Dual licensed under the MIT or GPL Version 2 licenses. | |
* http://jquery.org/license | |
* | |
* http://docs.jquery.com/UI/Theming/API |
OlderNewer