Skip to content

Instantly share code, notes, and snippets.

View michelleboisson's full-sized avatar

Michelle Boisson michelleboisson

View GitHub Profile
@michelleboisson
michelleboisson / data-without-borders-hw2-part1.R
Created September 18, 2012 21:21
Data without Borders - Assignment 2
# Write code to return the percentage of people who were frisked for each
# race. In other words, count up the number of people who were frisked for a given race
# divided by the number of people of that race stopped. Which race leads to the highest
# percentage of frisks? Which one the lowest?
#read in the data
snf <- read.csv("http://www.jakeporway.com/teaching/data/snf_2.csv", as.is=TRUE)
#race1 is black
race1.in.total = table(snf$race ==1)
@michelleboisson
michelleboisson / assign1.R
Created September 12, 2012 22:06
Data without Borders - Assignment 1
#Read in the data, save it to variable 'data'
data = read.csv("http://www.jakeporway.com/teaching/data/snf_11_2011_1.csv", header=TRUE, as.is=TRUE)
#How many women were stopped?
sum(data$sex == "F")
#[1] 3927
#What percentage of the stops is this?
sum(data$sex == "F") / length(data$sex) * 100
#[1] 6.760316
@michelleboisson
michelleboisson / home.html
Created February 29, 2012 15:20
Selecting Options in dropdown menu from request.body
<form method="post">
<dl>
<% for(i=0; i<=itemTypes.length-1; i++) { %>
<dt><input type="checkbox" name="itemChoices" value="<%= itemTypes[i].itemTypeName %>"/> <strong><%= itemTypes[i].itemTypeName %></strong></dt>
<dd>Dominence Points: <%= itemTypes[i].domPts %><dd>
<dd>Picture: <%= itemTypes[i].picture %><dd>
<select>
<% for (r=rooms.length-1; r>=0; r--) { %>
<option value="<%= rooms[r].name %>"><%= rooms[r].name %></option>
<% } %>