Created
September 12, 2012 22:06
-
-
Save michelleboisson/3710286 to your computer and use it in GitHub Desktop.
Data without Borders - Assignment 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 | |
#How many different kinds of suspected crimes are there? | |
just_the_crimes = data$crime.suspected | |
length(unique(just_the_crimes)) | |
#[1] 1356 | |
#What do you think about that? Is that what you expected? | |
##There are many differeny crimes suspected. Yes, I expected that. | |
#Which precinct had the most stops? How many were there? | |
max(table(data$precinct)) | |
#[1] 2597 | |
which(table(data$precinct) == 2597) | |
#47 | |
#47 | |
#Which precinct had the least stops? | |
min(table(data$precinct)) | |
#[1] 139 | |
which(table(data$precinct) == 139) | |
#13 | |
#13 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment