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
# 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) |
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
#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 |
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
<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> | |
<% } %> |
NewerOlder