A solution to proportional comparisons between independent groups, inspired by my memory of stadium checkers.
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
var dataset = { | |
data1 : | |
{ chem:"Amitriptyline", | |
data : [ | |
{"value":.8244,"name":"Least"}, | |
{"value":.7776,"name":"Less"}, | |
{"value":.4922,"name":"More"}, | |
{"value":.4567,"name":"Most"} | |
] |
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
//Add items to select | |
var chems = JSONSelect.match(".chem",rawdata).sort(); | |
//All as first option | |
chems.splice(chems.indexOf("All"),1) | |
var opt = document.createElement('option'); | |
opt.value='All'; | |
opt.innerHTML='All'; | |
document.getElementById("drug_drop").options.add(opt) |
A scatter plot that pivots one axis from raw to percent.
A intro demonstration of the general update pattern on a simple HTML table.
An simple multi-line chart that pivots from raw values to percent change using separate CSVs.
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
function manhattan(userRating, matchRating){ | |
/* | |
Calculates the manhattan distance between two ratings sets. | |
ratings are objects like this: | |
{speed:1, fitness:3, likeability:6} | |
We assume both sets have the same ratings categories, just different scores. | |
*/ | |
var distance = 0; | |
for (rating in userRating){ | |
distance = distance + Math.abs(userRating[rating] - matchRating[rating]) |
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(RPostgreSQL) | |
library(dplyr) | |
library(lazyeval) | |
library(userfriendlyscience) | |
# DB Connections | |
partd <- tbl(src_postgres(dbname = "propublica", user="postgres"), "partd") | |
# Change specialty filter |
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) | |
# Load acs library | |
# Complete docs at https://cran.r-project.org/web/packages/acs/acs.pdf | |
library(acs) | |
# First, create a geography | |
# For example, all counties in Texas | |
tx.counties = geo.make(county="*", state='TX') | |
# Or all tracts in Dallas and Tarrant county, using fips code |