Analysis of Global Terrorism Activity
Copyright 2013 Dean Attali. Licensed under the MIT license.
UBC STAT545A Final Project
A visual report with written analysis of this project, but without all the code, is available here.
In this project, I explored a dataset containing information about global terrorism acts since 1970, and attempted to make the findings as visual as possible. The dataset used is called the Global Terrorism Database (available here), and contains over 100,000 terrorist incidents worldwide, with over 100 different attributes for each incident. Another dataset that is used to retrieve some additional information about countries is the GapMinder data (available here). The results include 14 plots, 2 maps, and 4 tables. All look beautiful and interesting! Most of the analysis is done globally, but one of the scripts focuses on terrorism in Israel since it is very relevant to me.
If you just want to see the results and not run the scripts yourself, all relevant output is in the 'results' folder.
How to replicate/run the analysis:
- Download the 2 data files: globalterrorismdb.csv, gapminderDataFiveYear.txt
- Download the 8 required R files: MakeFile.R, common.R, 00_installPackages.R, 01_preprocessData.R, 02_analysisPlots.R, 03_analysisMaps.R, 04_integrateGapMinder.R, 05_israel.R
- Make sure all the above files are in the same directory
- If this is the first time running the pipeline, you will need to run 00_installPackages.R to install the required R packages
- Run MakeFile.R (ensure the working directory is set to the above directory)
- Note that MakeFile.R will run all the scripts. Any that the code was modulated in a way that any of the scripts can also be run individually
- results/ - All plots and tables generated by the analysis are outputted in this directory
- TerrorismDatabaseDesc.pdf - Describes the dataset and how to use it
- MakeFile.R - The main R file that runs all the scripts
- 00_installPackages.R - Installs required packages
- 01_preprocessData.R - Clean and process the data
- 02_analysisPlots - Using plots to explore the terrorism database
- 03_analysisMaps - Visualizing some data on a world map
- 04_integrateGapMinder - Merge data with GapMinder to compare terrorism vs GDP
- 05_israel.R - Analysis of terrorism in Israel
- common.R - Has common functionality needed for most scripts
- globalterrorismdb.csv - Raw unprocessed input from Global Terrorism Database
- globalterrorismdb_clean.csv - Processed, clean terrorism data
- gapminderDataFiveYear.txt - GapMinder raw data
- terrorism.Rmd, terrorism.html - The R Markdown and HTML of a report version of this project