Skip to content

Commit

Permalink
[ADD & UPD]
Browse files Browse the repository at this point in the history
Add a new file "todo.txt" with a list of tasks and their status
Also updated some code, and started the Kernel.
  • Loading branch information
sssusana committed Oct 7, 2017
1 parent edd41a4 commit 95adc72
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 7 deletions.
19 changes: 12 additions & 7 deletions crime_r.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Import data
library(readxl)
library(qplot)
library(ggplot2)
database <- read_excel("~/GitHub/Kaggle_cp/crimeds.xls")

#Process of subsecting data, based on values of 3 variables:
Expand Down Expand Up @@ -38,6 +39,12 @@ install.packages("scatterplot3d")
library(scatterplot3d)
attach(crimeds)
scatterplot3d(PA, VA, main="3D representation of PA vs VA")

## Age difference between Perpretator and Victims
crimeds$AgeDifference = crimeds$`Perpetrator Age` - crimeds$`Victim Age`
qplot(crimeds$AgeDifference,binwidth=1)


#Histograms (for numeric data) and tables for categorical
hist(crimeds$Year)
hist(crimeds$`Victim Count`)
Expand Down Expand Up @@ -92,7 +99,7 @@ ggplot(data=crimeds, aes(crimeds$Month)) +

<<<<<<< HEAD

library(ggplot2)

## Weapons without Unknown values

ggplot(data=Weapon2, aes(Weapon2$Weapon)) +
Expand All @@ -105,16 +112,14 @@ ggplot(data=Weapon2, aes(Weapon2$Weapon)) +

#Weapons by crime Type (absolute freq)
table(Weapon2$Weapon, Weapon2$`Crime Type`)

#Relative frequency of weapons used:
weaponf = Weapon2$Weapon
weapon.freq=table(weaponf)
weapon.rel.freq = weapon.freq / nrow(crimeds)
sort(weapon.rel.freq, decreasing = TRUE)

#

colnames(crimeds)

=======
## Age difference between Perpretator and Victims
crimeds$AgeDifference = crimeds$`Perpetrator Age` - crimeds$`Victim Age`
qplot(crimeds$AgeDifference,binwidth=1)

>>>>>>> 15851344763fca6287e4097d7a2776f27b7b8d52
29 changes: 29 additions & 0 deletions todo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Descriptive Analysis of this:

"State"
“Year" - Done
"Month" - Done
"Incident"
"Crime Type"
"Crime Solved"
"Victim Sex"
"Victim Age"
"Victim Race"
"Victim Ethnicity"
"Perpetrator Sex"
"Perpetrator Age"
"Perpetrator Race"
"Perpetrator Ethnicity"
"Relationship"
"Weapon"
"Victim Count"
"Perpetrator Count"


Profiling:
Relationship Between the fw Variables

Victim Age and Perpetrator Age - Done
Relationship Victim/Perpetrator
Weapon/Relationship
Victim Count/Weapon

0 comments on commit 95adc72

Please sign in to comment.